Talk martial arts at KarateForums.com

Bookmark and Share

Warning: Cannot modify header information...

Warning: Cannot modify header information...

Postby JohnMcK » December 6th 2003, 10:38 pm

phpBB wrote:Warning: Cannot modify header information - headers already sent by (output started at /path/to/file/filename1.php:z) in /path/to/file/filename2.php on line xxx


This is a very common error message and one that is usually very easy to track down and fix.

The error is generally the result of extraneous characters before the start of your php files. Make sure there is nothing, not even spaces before <?php or after ?>. These should be the first and last lines of your PHP files, respectively.

Example: Incorrect php file
Code: Select all
    <?php

echo "This php file will trigger the Cannot-modify-header-information error.";
echo "Note the extra spaces before the <?php.";
echo "There are 4 of them, but you don't want even 1.";

?>


Example: Correct php file
Code: Select all
<?php

echo "This php file will NOT trigger the Cannot-modify-header-information error.";
echo "Note the evil extra spaces before the <?php have been removed.";

?>


To find and fix this error, check the files mentioned in the error message, particularly the file I've highlighted in red in the example above. Remove any extra characters that appear before <?php or after ?>.

Thanks to A_Jelly_Doughnut for catching my omission.

John McKernan (JohnMcK)
Retired phpBBHacks.com Support Team Member
User avatar
JohnMcK
Dedicated User
 
Posts: 3868
Joined: April 7th 2003, 4:34 pm
Location: Quakertown, PA

Return to phpBB 2: Troubleshooting

Who is online

Users browsing this forum: No registered users and 0 guests