0

I got some error when I uploaded my site to server. The error is:

Cannot modify header information - headers already sent by (output started at.....)

My site works fine on my localhost. Whats the possible error?

Sanket Raut
  • 87
  • 1
  • 2
  • 7
  • You cannot send an HTML header after if you have output *anything* at all - even if was just a space. I think you had better post some code here and then we can help you. – Mawg says reinstate Monica Feb 23 '11 at 06:08
  • 1
    Solution: read the **complete** error message, including the mentioned line number that causes the error. http://stackoverflow.com/tags/php/info – mario Feb 23 '11 at 06:11
  • @mario - it still amazes me that people don't actually __read__ the error message – Mark Baker Feb 23 '11 at 08:54

2 Answers2

0

your server settings are probably just suppressing the error on your local machine, but it's almost impossible to tell without more information.

Things to watch out for include making sure there are no characters before the opening <?php, for example. This includes a UTF8-BOM. But really it's difficult to know without more info.

simon
  • 15,344
  • 5
  • 45
  • 67
  • Igot some new error :Cannot send session cookie - headers already sent by (output started at /home/ – Sanket Raut Feb 23 '11 at 06:32
  • @Sanket Raut: That's not a new error. It's basically the same error. Cookies are sent through HTTP headers as well. – Sander Marechal Feb 23 '11 at 06:46
  • @Sander Marechal:what can be the possible settings that i would have to make on my server. How can set output_buffering value to 4096 externally on my server? – Sanket Raut Feb 23 '11 at 06:56
  • @Sanket Raut: If you cannot modify the php.ini, you can also set this value in your .htaccess file. Also, don't set it to 4096 but set it to "on" instead. Then your buffer can be arbitrary large. – Sander Marechal Feb 23 '11 at 22:51
0

Remove any/all echo, print() or print_r() statements before the header() function is called.

Alternatively, comment them out //

Anriëtte Myburgh
  • 13,347
  • 11
  • 51
  • 72
  • what can be the possible settings that i would have to make on my server. How can set output_buffering value to 4096 externally on my server? – Sanket Raut Feb 23 '11 at 06:50
  • I don't think there's a setting you can change. I'm talking about statements in your PHP script itself, not some server setting file. – Anriëtte Myburgh Feb 23 '11 at 07:10