If the program is running php see this warning: "Warning: Cannot modify header information - headers already sent by ...."
Few notes based on the following user posts:
There are several solutions:
1. Blank lines :
Make sure no blank line after of the calling php script.
Check is not followed by a blank line, in particular, include or require the file. Many problems caused by these blank lines.

2. Use exit statement (with the exit to solve):
Use exit after header statement seems to help some people
After the header with exit ();
header ("Location: xxx");
exit ();

3. PHP has this annoying problem, if your HTML goes before any PHP code or any header modification before redirecting to certain page, it'll said "Warning: Cannot modify header information - headers already sent by ...." Basically anytime you output to browser, the header is set and cannot be modified. So two ways to get around the problem:
3a. Use Javascript (using Javascript to solve):
Since it's a script, it won't modify the header until execution of Javascript.
Javascript can be used to replace the header. But the above code I did not execute successfully ... Also note that, using this method requires browser support Javascript.
3b. Use output buffering (use output buffering to solve):

... HTML codes ...
... PHP codes ...
header ("Location: ....");
ob_end_flush();
?>
This will save the output buffer on server and not output to browser yet, which means you can modify the header all you want until the ob_end_flush() statement. This method is cleaner than the Javascript since Javascript method assumes the browser has Javascript turn on. However, there are overhead to store output buffer on server before output, but with modern hardware I would imagine it won't be that big of deal. Javascript solution would be better if you know for sure your user has Javascript turn on on their browser.

4.set output_buffering = On in php.ini
set output_buffering = On will enable output buffering for all files. But this method may slow down your php output. The performance of this method depends on which Web server you're working with, and what kind of scripts you're using.
5. Remove bom.If you use utf-8 encoding, must be removed in the UTF-8 BOM, this is because utf-8 encoded file containing the bom, php4, 5 are not supported by the bom.

This article address is http://www.computerites.com/computer-skills/2011/12/cannot-modify-header-information-2-23.html



This address is http://www.computerites.com/computer-skills/2011/12/cannot-modify-header-information-2-23.html