流或文件"/storage/logs/laravel.log"被指定为流或文件.无法打开:无法打开流:权限被拒绝 [英] The stream or file "/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

查看:872
本文介绍了流或文件"/storage/logs/laravel.log"被指定为流或文件.无法打开:无法打开流:权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我导航到CentOS服务器上的Laravel应用程序时,它显示 HTTP错误500

When I navigate to Laravel app on my CentOS server, it gives HTTP ERROR 500

因此,当我检查服务器错误日志时,它会显示此错误

So, when I checked my server error log, it says this error

PHP Fatal error:  Uncaught UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107\nStack trace:\n#0 

我已经为存储和引导目录设置了777权限.

I have already set 777 permission to storage and bootstrap directories.

这个非常Laravel的应用程序可以在另一台服务器上正常运行.那么,这有什么大不了的?

This very Laravel application runs fine on another server. So, what's the big deal here ?

推荐答案

可以通过禁用SE-Linux来解决此错误.

This error can be fixed by disabling SE-Linux.

通过输入...检查是否已启用它.

Check if it has been enabled by typing...

$ sestatus

因此,请通过键入...禁用它.

So, disable it by typing...

# setenforce 0

据说必须重新启动系统才能使更改生效.

It is said that the system needs to be restarted to to take effect the changes.

但是,对我来说,重新启动Apache就足够了,并解决了问题:-)

However, for me, restarting Apache was enough and fixed the problem :-)

希望这会有所帮助!

这篇关于流或文件"/storage/logs/laravel.log"被指定为流或文件.无法打开:无法打开流:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆