簡體   English   中英

為什么當我的php網頁位於在線Web服務器上時,卻無法發送會話Cookie錯誤?

[英]why am i getting the cannot send session cookie error on my php webpage when it is in an online webserver?

我在使用WAMP服務器開發的本地計算機上有一個完美的工作站點。 我嘗試將其移至Webost,然后在頁面中不斷收到此消息-

錯誤-

<b>Warning</b>:  session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /www/host.com/appi/htdocs/connect.php:11) in <b>/www/host.com/appi/htdocs/session-public.php</b> on line <b>5</b><br /> 
<br /> 
<b>Warning</b>:  session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /www/host.com/appi/htdocs/connect.php:11) in <b>/www/host.com/appi/htdocs/session-public.php</b> on line <b>5</b><br />

我的所有頁面都有一個會話開始設置(如果尚未設置)。 我的問題是,如果它在我的本地計算機上有效,為什么將同一代碼在線移到共享Web服務器時會出現此錯誤?

PHP具有許多配置選項 ,使您可以從正在運行的腳本之外配置PHP。 其中之一是output_buffering ,它允許您在將任何輸出發送到客戶端之前隱式緩沖任何輸出。

如果啟用了輸出緩沖,那么即使在某些輸出緩沖之后,您也可以修改HTTP標頭,因為輸出被緩沖並且不會立即發送到客戶端,這暗示了之前發送HTTP標頭。

因此,似乎您的本地計算機啟用了output_buffering,而其他服務器未啟用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM