-2

我收到以下错误:

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

它发生在每当session_start()我刷新cookie.


同一页面(和代码)正在另一台机器上工作。唯一的区别是安装的 Apache 服务器(我的是 2.2.21,另一个是 2.2.17)。

php版本为5.2.17,php.ini文件相同。


我该如何解决这种情况?

4

3 回答 3

0

大多数情况下,在调用 session_start() 之前从 php 脚本发送内容/输出时会发生此错误。

通常在<?php您可能有空间或其他标志/字母之前。在您的情况下,问题出在 monitor.php 第 2 行 - 您可能会在调用之前回显session_start()

于 2012-05-23T09:52:35.713 回答
0

php.ini 文件是否相同?对我来说,听起来其中一个可能有 output_buffering=on,而另一个(失败的那个)有 output_buffering=off。

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

显然,这是默认的取决于完成了哪种 PHP 安装。

于 2012-05-23T09:52:56.133 回答
0

您应该检查文件的第二行monitor.php,因为该行似乎向浏览器输出了一些文本。

session_start()输出文本后无法执行。

于 2012-05-23T09:53:37.277 回答