Monday, April 28, 2008

Warning: Cannot modify header information - headers already sent (PHP error)

This error appears when one of the following errors occurs:

a.) white space/ unwanted characters, before the header() tag was called. Just delete extra spaces before the header() tag remove this error.

b.) from php.net; Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. This means that you must check whether you have statements like print_r(), echo(), etc. that displays something before the header(). I suggest you comment out the statement causing the error.

The application should be working fine after following the workaround.