Difference between revisions of "Cannot modify header information - headers already sent"

From Joomla! Documentation

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

Revision as of 02:54, 23 July 2008

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.