2012-05-23 46 views
-2

,我發現了以下錯誤:錯誤在PHP頁面

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文件是一樣的。


我該如何解決這種情況?

回答

0

這個錯誤主要發生在您調用session_start()之前從php腳本發送內容/輸出的地方。

通常在<?php之前,您可能會有空間或其他符號/字母。 在你的情況下,問題是在monitor.php第2行 - 您可能在調用之前恰好回顯session_start()

0

您應該檢查文件monitor.php的第二行,因爲此行似乎向瀏覽器輸出了一些文本。

輸出文字後不能執行session_start()