PHP - Warning: session_start(): Cannot send session cookie & Cannot send session cache limiter 错误解决方案
作者: 李嘉 日期: 2009-02-16 19:12
最近的一个PHP项目Annotation tool中,在开发环境Windows下一切正常,而在Linux下配置环境的时候运行出错,得到以下错误提示:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/annotation/logincheck.php:11)
in /var/www/html/annotation/logincheck.php on line 34
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/annotation/logincheck.php:11)
in /var/www/html/annotation/logincheck.php on line 34
和国外的朋友讨论了一下,应该是特殊字符或编码的问题,临时解决方法如下:
you need to add this to the top:
<? ob_start(); ?>
and add this to the bottom:
<? ob_flush(); ?>
在出现问题的PHP文件头前加<? ob_start(); ?> ,文件末尾加<? ob_flush(); ?> .
OK, 问题解决。
订阅
上一篇
返回
下一篇
