Laravel 拉维流或文件";存储/存储日志”;无法在追加模式下打开:无法打开流:RHEL8中的权限被拒绝

Laravel 拉维流或文件";存储/存储日志”;无法在追加模式下打开:无法打开流:RHEL8中的权限被拒绝,laravel,rhel8,Laravel,Rhel8,我需要帮助。我在RHEL 8服务器中安装了Laravel 但我得到了这个错误。我知道这个问题已经贴了很多次了,但是我试着按照这个建议去做,但是到目前为止我运气不好。我不知道为什么 The stream or file "/var/www/html/vpa/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied 我试图使用此命

我需要帮助。我在RHEL 8服务器中安装了Laravel

但我得到了这个错误。我知道这个问题已经贴了很多次了,但是我试着按照这个建议去做,但是到目前为止我运气不好。我不知道为什么

The stream or file "/var/www/html/vpa/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied
我试图使用此命令更改权限,但无效

sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache 
sudo chmod -R 755 storage
sudo chmod -R 755 bootstrap/cache

sudo setenforce 0 
sudo chcon -t httpd_sys_rw_content_t storage

php artisan config:clear
php artisan config:cache
composer dump-autoload

sudo systemctl restart httpd
sudo reboot 

对我来说似乎什么都不管用。我不知道还能做什么。请帮助我

在我的情况下,除了确保所有权限都正确之外,我还必须禁用SELinux。

我已通过运行以下命令更改了我的存储权限。它对我有效:

第1步:

sudo chmod-R+rwX

第二步:

sudo chown-R$(whoami)


简单的读/写权限允许运行此命令

chmod -R 777 /storage/laravel.log”
为我工作

sudo chown -R $USER:$USER /var/www
sudo chmod -R 755 /var/www
sudo chmod -R 777 storage/*
sudo chmod -R 777 bootstrap/*
这是我的工作

sudo chown -R www-data:www-data ./storage
find ./storage -type d -exec chmod 775 {} \;
find ./storage -type f -exec chmod 664 {} \;
sudo chown www-data:www-data ./bootstrap/cache -R
find ./bootstrap/cache -type d -exec chmod 775 {} \;
sudo chown -R www-data:www-data .env
find .env -type d -exec chmod 775 {} \;

这一步解决了这个问题

php artisan config:clear

php artisan cache:clear

sudo chmod -R 775 /var/www/your_folder

sudo chown -R www-data:www-data var/www/your_folder 

sudo chmod+w存储/logs/laravel.log

不要使用777


这些都是不负责任的权限

我也面临着这个问题。不过,我正在Nginx上运行我的应用程序。不管怎样,已经有一段时间了。你最终能自己解决吗?我只是通过运行
setEnforce0
@KelvinLow解决了我的问题。我在RHEL8中找到了解决方案。您需要将chmod设置为775,以用于文件夹存储和引导/缓存,而不是755。是的,你需要“设置0”好知道。您是否介意回答自己的问题,以便其他人知道您的问题已得到回答?千万不要推荐
777
<代码>755好得多。请您添加您的位置好吗?您执行这些命令的路径是什么。@Pathros谢谢您的查询。基本上,我在用VisualStudio代码做一个laravel项目,我遇到了存储问题。然后我打开visual studio code*终端并执行这些命令,它对我起了作用。永远不要推荐
777
<代码>755好得多。这对我有用