PHP 订阅所有【PHP】的日志

PHP网站报Warning: session_start(): open错误的解放方法

今天我们在调试服务器的时候出现了一个错误,下面是错误的内容

Warning: session_start(): open(C:/Program Files/php/sessiontemp\sess_0cde28de3ce1a2e2cc8e8723b5a40279, O_RDWR) failed: Permission denied (13) in D:\home\400m\zmxxx\web\syssite\install\datainstall.php on line 7

Warning: Unknown(): open(C:/Program Files/php/sessiontemp\sess_0cde28de3ce1a2e2cc8e8723b5a40279, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:/Program Files/php/sessiontemp) in Unknown on line 0

通过以上的错误我们可以看到是因为没有了临时目录造成的,

解决办法:
修改php.ini中的session.auto_start = 0 为 session.auto_start = 1

重启IIS调试!

如果还提示以下类似的警告:
Warning: session_start() [function.session-start]: open(/tmp\sess_84cb589ea249708b09c3d5e6836fdd0d, O_RDWR) failed: No such file or directory (2) in E:\web\htdocs\111.php on line 9
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at E:\web\htdocs\111.php:8) in E:\web\htdocs\111.php on line 9
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\web\htdocs\111.php:8) in E:\web\htdocs\111.php on line 9
Warning: Unknown(): open(/tmp\sess_84cb589ea249708b09c3d5e6836fdd0d, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

就是 session变量需要系统的临时空间
session.save_path = "设置一个有效文件夹的绝对路径"
(比如 session.save_path = "C:\WINDOWS\temp" )
session.save_path =前面的 “;”分号去掉
另外编辑该文件夹的权限 添加EVERYONE 有写入修改权限即可!

============================================
补充记录,这次客户网站遇到问题,停止apache和mysql服务后删除了tmp文件夹重建,设置文件夹权限为777,并做以上设置后错误解决。

评论: 0 | 引用: 0 | 查看次数: 1822
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 关闭 | [img]标签 关闭