编译安装PHP使用session_start()时报错&解决办法

WBOY
Release: 2016-06-23 13:42:12
Original
1094 people have browsed it

系统上的PHP是编译安装的,在session_start()的时候报错!


A 错误信息:

Warning: session_start(): open(/var/lib/php/session/sess_qavhhacl7lrdbggauasf1qdlo5, O_RDWR) failed: No such file or directory (2) in /www/tool/classes/service/User.php on line 75

1
Warning: Unknown: open(/var/lib/php/session/sess_qavhhacl7lrdbggauasf1qdlo5, 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 (/var/lib/php/session) in Unknown on line 0


B 查看php.ini:

session.save_path = "/var/lib/php/session" // session的存放路径

所以上面的文字是提示没有该目录


C 解决问题:

创建上面的目录

mkdir session

chmod -R 777 session

再次运行程序就OK了


D 查看更多:

(1)

 pwd
/var/lib/php/session
?  session  ls
sess_qavhhacl7lrdbggauasf1qdlo5

(2)

用firebug查看cookie:

PHPSESSID qavhhacl7lrdbggauasf1qdlo5 // php.ini session.name = PHPSESSID


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template