Cannot modify header information – headers already sent

Update: To identify files that have a problem, I wrote a script. Checkout this blog post.

how often do you see this message?. I was furious and agitated for last two hours. I knew that I have solved this problem before, but didn’t remember either the cause or the solution. Not to reinvent the wheel again, I am documenting it right now, for myself and for others.

There are many possible things that can cause this error. However, the most common thing, atleast in my case, that causes this error is having some spaces after the closing PHP tag i.e. “?>”. This often occurs when you copy and paste the code. To solve it make sure there are no other characters after you PHP closing tag. Delete any trailing spaces.

Hopefully you will find this helpful.

 

3 Responses

  1. Thank you. :)

  2. Thank you so much!!

Leave a Reply