"Warning: Cannot modify header information"
The PHP warning
Warning: Cannot modify header information - headers already sent
is caused, because there’s output (from PHP) already, when there’s a call to e.g.
header(), which cannot send a HTTP header then anymore.
If you get this error, it is most likely you recently changed something in a file (e.g. a configuration file in /conf).
The error is often caused by added whitespace (space or line feed) *before* the first
<?php or *after* the closing
You can remove the error by opening the file stated in the notice and remove the whitespace. Because whitespace is often hard to detect, you may want to use a fresh copy of the file and make the changes anew.
Usually the location of the error is given in the error message itself:
Warning: Cannot modify header information - headers already sent by (output started at /path/to/file/with/output:LINE) in /path/to/file/with/warning on line X
Take a look at
/path/to/file/with/output, especially at/around line LINE.
If there’s no "output started at" info given, you’re kinda out of luck. The only possible solution (apart from ‘’taking a look at the file’s you’ve modified'’) seems to be adding manually
echo "foo"; statements into the code to see if the error already gets triggered here (then the /path/to/file/with/warning and "line X" would change accordingly).
Created by • Last edit by on Jul 12, 2013