FAQ: Warning: Cannot modify header information - headers already sent

Moderator: mcsmom

Post Reply
User avatar
toubkal
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Aug 18, 2005 4:35 pm
Location: Cheshire, England
Contact:

FAQ: Warning: Cannot modify header information - headers already sent

Post by toubkal » Thu Aug 18, 2005 9:45 pm

Q. What causes "Warning: Cannot modify header information - headers already sent" to appear?

An example:
I have Mambo pretty much installed, but when I get to the index.php file of the site,
it has the mambo default site with the following lines above it:
(example of error code displayed)

GLOBALS[$key2]=$value2; } } } ?>
Warning: Cannot modify header information - headers already sent by (output started at
/home/somesite/somefolder/anotherfolder/folder/globals.php:44)
in /home/somesite/somefolder/anotherfolder/folder/includes/mambo.php on line 274


A. PHP files cannot have any blank spaces/lines outside the PHP code and will result in this type of error.
There cannot be any white space or blank lines either before or after the opening and closing PHP tags ().
A single extra character, even a blank space, can cause this.

Look at any files that you have modified to see if there is any such space.
Online file managers, such as used in cPanel, when used to edit files will often add a blank line at the end of the code.
Always check for extra spaces/lines after the PHP code before saving  .php files.
Last edited by kenmcd on Sun Sep 04, 2005 10:24 am, edited 1 time in total.
Look at the page source... Lots of useful info...

de
Joomla! Apprentice
Joomla! Apprentice
Posts: 32
Joined: Thu Aug 18, 2005 9:06 am
Contact:

Re: Warning: Cannot modify header information - headers already sent

Post by de » Thu Aug 18, 2005 9:54 pm

Certainly a FAQ... may I add a simple thing (though it gets overseen a lot)...
If this part is present in the error message (which is not always the case):
output started at /home/somesite/somefolder/anotherfolder/folder/globals.php:44

...then it tells you exactly which file and even the line which caused it. (This means if it tells you globals.php you don't need to search in configuration.php)


Post Reply