Fatal Error – Cannot modify header information

You’ve been hacking around in WordPress and you get…

Fatal Error – Cannot modify header information – headers already sent …

Why? Very simply, because the script has output something (… ie. printed it to your browser) before trying to execute a  PHP header(“…”) statement – which just isn’t allowed with PHP. Often, it’s a header(“Location: …”) command.

So the output might be an echo or a print you’ve just added in the wrong place – but much more likely it’s a blank space or line(s) outside the opening <?php or closing ?>  in a file.

Have a look at the error message to find which file has produced the warning and edit out the whitespace – remember, check top and bottom.

And always use a PHP/HTML text editor for this – or anything lo-tech… the big heavy word processing programs, Word, Open Office often insert hidden characters in the file. 

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • LinkedIn
  • Reddit
  • StumbleUpon
  • RSS
  • Twitter

Leave a Reply