Home >Backend Development >PHP Tutorial >PHP由session文件夹权限不够引起的报错

PHP由session文件夹权限不够引起的报错

WBOY
WBOYOriginal
2016-06-20 12:37:362836browse

之前折腾完gunicorn,服务器其他的网站就全部都挂了,其中几个网站报错如下:

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

phpMyAdmin报错我没有记下来,刚刚搜了一下,应该翻译是“无法在发生错误时创建会话,请检查 PHP 或网站服务器日志,并正确配置 PHP 安装。”

仔细看了下报错,第一个那一大长串报错分成两段,一段是说访问失败了,一段是说写session失败了。phpmyadmin的报错也是创建会话失败。于是找到php.ini,里面写的好好的:

session.save_path = /var/lib/php/session

这个文件夹是确实存在的,那就应该是权限问题。于是

chmod  -R 777 /var/lib/php/session

解决问题。

Statement:
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