leedaning的专栏

学习 + 分享

larave 5 could not be opened: failed to open stream: Permission denied

以前使用的是ubuntu系统,最近换了fedora用,LNMP下以前项目运行没问题,这次不行了,查看php-fpm(tail /var/log/php-fpm/www-error.log)的错误日志如下:

[19-Nov-2015 13:52:42 Asia/Shanghai] PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/usr/share/nginx/wakav/storage/logs/laravel-2015-11-19.log" could not be opened: failed to open stream: Permission denied' in /usr/share/nginx/wakav/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87
Stack trace:
#0 /usr/share/nginx/wakav/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(88): Monolog\Handler\StreamHandler->write(Array)
#1 /usr/share/nginx/wakav/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\RotatingFileHandler->write(Array)
#2 /usr/share/nginx/wakav/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#3 /usr/share/nginx/wakav/vendor/monolog/monolog/src/Monolog/Logger.php(565): Monolog\Logger->addRecord(400, 'exception 'Symf...', Array)
#4 /usr/share/nginx/wakav/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(47): Monolog\Logger->error('exception 'Symf...')
 in /usr/share/nginx/wakav/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87

后来请运维的高手看了下说是Selinux的问题,把Selinux关闭掉重启就好了。
查看Selinux状态:
1、

/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态

SELinux status:                 enabled

2、getenforce ##也可以用这个命令检查(这个没试过)

关闭SELinux:

1、临时关闭(不用重启机器):

setenforce 0                  ##设置SELinux 成为permissive模式

    ##setenforce 1 设置SELinux 成为enforcing模式

2、修改配置文件需要重启机器:

修改/etc/selinux/config 文件

SELINUX=enforcing改为SELINUX=disabled

重启系统即可

Author:leedaning
本文地址:http://blog.csdn.net/leedaning/article/details/49930989

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/leedaning/article/details/49930989
个人分类: Laravel
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

larave 5 could not be opened: failed to open stream: Permission denied

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭