繁体   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