关于项目部署到服务器上,接口数据正常,状态码500,可能是session报错问题

刚开始一直报500错误,页面不提示,也没想着去查看日志文件。好几天了,一看日志,发现是这个问题。问了一下,是session的问题、

2017/07/25 16:57:49 [error] 2300#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'yii\base\ErrorException' with message 'session_write_close(): open(/var/lib/php/session/sess_itrssn0785o64bpt6b9n2utl91, O_RDWR) failed: Permission denied (13)' in /mnt/hgfs/UnknownBlog/vendor/yiisoft/yii2/web/Session.php:187

Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(2, 'session_write_c...', '/mnt/hgfs/Unkno...', 187, Array)
#1 /mnt/hgfs/UnknownBlog/vendor/yiisoft/yii2/web/Session.php(187): session_write_close()
#2 [internal function]: yii\web\Session->close()
#3 {main}
thrown in /mnt/hgfs/UnknownBlog/vendor/yiisoft/yii2/web/Session.php on line 187" while reading response header from upstream, client: 192.168.1.102, server: admin.blog.org, request: "GET /login/index HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "admin.blog.org", referrer: "http://admin.blog.org/login/index"

 

关于这个错误,是session权限问题

在index.php 打印phpinfo();查看session的目录

然后给session设置777权限;解决

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

Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(2, 'session_write_c...', '/mnt/hgfs/Unkno...', 187, Array)
#1 /mnt/hgfs/UnknownBlog/vendor/yiisoft/yii2/web/Session.php(187): session_write_close()
#2 [internal function]: yii\web\Session->close()
#3 {main}
thrown in /mnt/hgfs/UnknownBlog/vendor/yiisoft/yii2/web/Session.php on line 187" while reading response header from upstream, client: 192.168.1.102, server: admin.blog.org, request: "GET /login/index HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "admin.blog.org", referrer: "http://admin.blog.org/login/index"

 

关于这个错误,是session权限问题

在index.php 打印phpinfo();查看session的目录

然后给session设置777权限;解决

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

猜你喜欢

转载自www.cnblogs.com/jn1011/p/10001069.html

相关文章