“流或文件"laravel.log"无法打开:无法打开流:权限被拒绝"

2022-01-13 00:00:00 centos php laravel-5

几天前我将文件上传到我的cent OS服务器,它工作正常,但从今天开始我收到错误.

I upload the file to my cent OS server a few days ago, it was working fine, but from today I am getting the error.

流或文件/var/www/html/hasibtest/storage/logs/laravel.log"无法打开:无法打开流:权限被拒绝

The stream or file "/var/www/html/hasibtest/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

我的日志文件在哪里具有 777 权限,我也在尝试使用 0755、0644

Where My log file is with 777 permission I am also trying with 0755, 0644

谁能告诉我如何解决这个问题?

can anyone tell me how I can resolve this issue?

推荐答案

先试试这个递归获取目录的所有权

first try this to take ownership of the directory recursively

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

然后使用以下设置正确的目录访问权限

Then use the following to set proper directory access

chmod -R 775 storage
chmod -R 775 bootstrap/cache

永远不要将目录权限设置为 777(除非您知道自己在做什么)

相关文章