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

转载至:https://cloud.tencent.com/developer/ask/170024

Linux 部署 Laravel项目,运行报错

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

网上找到如下解决方法,测试有效

 

Web服务器用户和组依赖于你的Web服务器和操作系统。找出你的Web服务器用户和组使用以下命令的内容。对于nginx使用:

ps aux|grep nginx|grep -v grep

用于apache:

ps aux | egrep '(apache|httpd)'

cd /data/www/laravel/ 目录执行

chown -R $USER(用户):web用户组 storage

 

 

 

docker php容器提示storage文件夹没权限

# 进入php容器
# 查看镜像php进程
ps -axu | grep php

 

 可以看到进程拥有者是www-data

# 进入项目设置
chown -R $USER:www-data storage
chmod -R 775 storage

 

posted @ 2019-11-23 22:04  php的自我修养  阅读(6361)  评论(0编辑  收藏  举报