0

Possible Duplicate:
“Warning: Headers already sent” in PHP

I am using a local XAMPP install to test the development of a PHP/MySQL based website. My local PHP version is 5.3.8 and my webhost is using 5.2. I am getting header error:

Cannot send session cache limiter - headers already sent

on the hosted version that do not show up on the local version. Is this a version issue, a settings issue, or something else? I will change the code so that it works on both, but ideally, I'd like to have these two environments behave near identically.

Community
  • 1
  • 1
Soma Holiday
  • 185
  • 1
  • 1
  • 13
  • 1
    [this is probably the difference](http://www.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering) – Wrikken Oct 30 '12 at 18:31
  • Wrikken nailed it. Output_buffering was set to "no value" on the host and 4096 on my local server. This is mentioned in the thorough answer that Jocelyn mentioned as a possible duplicate, but I think this question is materially different. – Soma Holiday Oct 30 '12 at 19:24

2 Answers2

0

this is not related to php version, the diffrence is that error reporting is enabled on your host but not in yout local. Remember that session_start() 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 session_start() is called. The same problem exists when using a single PHP/HTML file.

Shahrokhian
  • 1,100
  • 13
  • 28
0

Have you compared html source codes from both servers? There may be another error or piece of string printed out that you haven't notice. Are php tags at the very beginning of the files? Even whitespace before php tag can cause this error.

Try to comment blocks of code to find what line is causing the error, or use exit function if the project is too big to just stop executing script at certain line and see if everything run well until that line.

Buksy
  • 11,571
  • 9
  • 62
  • 69