Posts Tagged ‘Cannot Modify Header Information’

Cannot Modify Header Information

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. Read more

Cannot Modify Header Information

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: Read more