Warning: "Headers already sent" or "Cannot modify header information"

Lets see, you install new PHP app and get bunch of warnings. It is sad, commonly you need PHP knowledge to understand them and fix. Probably you can request help from you hosting support, but they reject such problems saying "We don't fix your php applications".

Ok, google.com found a lot answers and solutions for this problem. But non of them is simple, non of them are short.

Technically main problem called "output logic problem", your php script try to send header after body was sent. And it is wonderful, because I have solution.

So, I will share the magic I use to help my clients quickly:
- php CAN control output
- everyone can activate output buffering

SOLUTIONs
First

  • create .htaccess and add next line:
    php_value output_buffering 4096
  • upload it
  • visit page

Problem not solved?
Second

  • remove .htaccess you uploaded
  • create php.ini with line:
    output_buffering = 4096
  • upload it
  • visit page

Problem gone you got your script up and working.

Trackback URL for this post:

https://www.kalexandr.com/trackback/117
Tags:
Links: