-2

I'm getting the following errors:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 3
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 20
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 24
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 25
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 38
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 39
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 52
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 52
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 38
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 39
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 52
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 52
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 76
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 77
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 96
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 96
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 96
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2.2\htdocs\monitor.php:2) in C:\Apache2.2\htdocs\monitor.php on line 96

It occurs whenever in the session_start() and when I refresh a cookie.


The same page (and code) is working in another machine. The only difference is the Apache Server installed (in mine is 2.2.21 and in the other is 2.2.17).

The php version is 5.2.17 and the php.ini file is the same.


How can I fix this situation?

afuzzyllama
  • 6,538
  • 5
  • 47
  • 64
ruir3
  • 1
  • 3

3 Answers3

0

Mostly this error occur where you send content/output from the php script before invoking session_start().

Often before <?php you might have space or other sign/letter. In your case the problem is on monitor.php line 2 - you might echoing just right before invoke session_start()

h4cky
  • 899
  • 1
  • 13
  • 33
0

Are the php.ini files the same? To me, it sounds like one of them might have output_buffering=on while the other (the one which is failing) has output_buffering=off.

http://www.php.net/manual/en/outcontrol.configuration.php

Apparently, which is default depends on what kind of PHP installation is done.

Alex
  • 3,429
  • 4
  • 36
  • 66
0

You should check the second line of your file monitor.php, as this line seem to output some text to the browser.

You cannot execute session_start() after having outputed text.

adrien
  • 4,399
  • 26
  • 26