PHP+mysql系统报错:PHP message: PHP Warning: Unknown: Failed to write session data (files)
PHP+mysql系统报错:PHP message: PHP Warning: Unknown: Failed to write session data (files)
故障现象,后台页面点击没有反应,也不报错
通过查看log文件,可以通过在nginx中单独定义错误日志文件,方便定位错误
/data/logs/www.aaasdk.com-error.log
报错信息:
PHP message: PHP 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" while reading upstream, client: 218.18.1.158, server: aaasdk.com, request:
"GET /inc/fun/verification_code.php?code_name=manage&code_length=4&code_char=en&code_creat=1&rand_code=65d23d8e07 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.17aaa.com", referrer: "http://www.aaa.com/manage/index.php?setTips=1"
2016/09/07 14:53:33 [error] 21880#0: *101 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): open(/var/lib/php/session/sess_5g65lrovdqg9avscb09oq1p161, O_RDWR) failed: Permission denied (13) in /var/www/web/www.aaasdk.com/inc/site_config.php
on line 10" while reading response header from upstream, client: 14.154.162.129, server: aaasdk.com, request: "POST /ajax/chack_name.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.17aaa.com", referrer: "http://www.17aaa.com/member/reg.php"
2016/09/07 14:53:33 [error] 21880#0: *101 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open(/var/lib/php/session/sess_5g65lrovdqg9avscb09oq1p161, O_RDWR) failed: Permission denied (13) in Unknown on line 0
解决办法:
修改/var/lib/php/session 目录权限 chmod 777 /var/lib/php/session