[Fix] Cannot modify header information - headers already sent by


There is an easy way out in order to solve this problem. After several puzzling encounters why this warning occurs to some files, at last a solution has been carved out.

From my experience, the cause of this are the whitespaces before or after the <?php ... ?> tags. That is, if you use the header() function, make sure that the file or any files (required or included) associated with it has no whitespaces to begin with.

Let me share two articles that has a good explainations on this case:

Solve PHP error: Cannot modify header information – headers already sent

Cannot modify header information - headers already sent by ...

 

 

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h1> <h2> <h3> <h4> <h5> <h6> <i> <u> <br> <br /> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.