【问题标题】:Laravel The stream or file "/storage/logs/laravel.log" could not be opened: failed to open stream: Permission deniedLaravel 无法打开流或文件“/storage/logs/laravel.log”:无法打开流:权限被拒绝
【发布时间】:2018-07-08 10:33:12
【问题描述】:

我在服务器 (Ubuntu 16.04) 上运行 Laravel 应用程序。我有一个错误

无法打开流或文件“/var/www/mydomain.com/storage/logs/laravel.log”:无法打开流:权限被拒绝

我已经用谷歌搜索了我的问题。我找到了this answer,但没有帮助。正如我发现的许多其他答案所建议的那样,我无法设置 777 存储权限(这很危险)。
还有其他建议吗?


更新:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

很有帮助

【问题讨论】:

  • 实际上,在回答中,用户说永远不要将此目录设置为 777,并建议更改目录所有权。
  • 所以我这样做了,但没有帮助(正如我在问题中提到的那样)
  • 您将权限设置为什么?您可能希望为日志目录设置类似 root:www 700 的内容(仅为 .log 文件设置可能不够)
  • @ti7 我将权限设置为root...
  • 对不起,上面明明应该是770;也需要组写入权限。请至少在问题中的日志目录中包含ls 的输出,以显示其权限和所有权。

标签: ubuntu-16.04 laravel-5.5 apache2.4


【解决方案1】:

这些命令很有帮助:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

【讨论】:

    猜你喜欢
    • 2018-05-06
    • 2018-10-03
    • 2020-06-16
    • 2021-10-03
    • 2019-08-09
    • 2019-09-10
    • 2019-02-10
    • 2021-10-03
    • 2021-06-26
    相关资源
    最近更新 更多