流或文件“/storage/logs/laravel.log”无法打开:无法打开流:权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47447864/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The stream or file "/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
提问by TharinduLucky
When I navigate to Laravel app on my CentOS server, it gives HTTP ERROR 500
当我导航到 CentOS 服务器上的 Laravel 应用程序时,它给出了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
I have already set 777 permission to storage and bootstrap directories.
我已经为存储和引导目录设置了 777 权限。
This very Laravel application runs fine on another server. So, what's the big deal here ?
这个 Laravel 应用程序在另一台服务器上运行良好。那么,这里有什么大不了的?
回答by TharinduLucky
This error can be fixed by disabling SE-Linux.
这个错误可以通过禁用 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.
据说需要重新启动系统才能使更改生效。
However, for me, restarting Apachewas enough and fixed the problem :-)
但是,对我来说,重新启动Apache就足够了并解决了问题:-)
Hope this helps!
希望这可以帮助!


