【问题标题】:Laravel failed to open stream: Permission deniedLaravel 无法打开流:权限被拒绝
【发布时间】:2017-06-13 23:25:47
【问题描述】:

我环顾四周,大多数答案都不是针对共享主机的,而这恰好是我的情况。

我在storagebootstrap/cache/775 上完成了chmod。我还有一个storage/framework/views目录,我也试过删除storage/logs/laravel.log

注意,该脚本在我以前的共享托管计划中运行良好,而且似乎只有带有 file_get_contents 的页面是问题所在。

有问题的文件是PostController.php line 17 中的ErrorException:我正在使用file_get_contents 调用。

【问题讨论】:

标签: php laravel laravel-5 ini


【解决方案1】:

在 CentOS 7 + Apache 上:

cd /var/www/laravelfolder
sudo chown apache:apache -R /var/www/laravelfolder
find . -type f -exec chmod 0644 {} \;
find . -type d -exec chmod 0755 {} \;
sudo chcon -t httpd_sys_content_t /var/www/laravelfolder -R
sudo chcon -t httpd_sys_rw_content_t /var/www/laravelfolder/storage -R
sudo chcon -t httpd_sys_rw_content_t /var/www/laravelfolder/bootstrap/cache -R

发件人:https://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/

【讨论】:

    【解决方案2】:

    尝试运行

    php artisan config:cache

    然后

    php artisan env

    【讨论】:

      【解决方案3】:

      我认为您设置了错误的权限。将 777 权限而不是 775 授予 bootstrap\cache 和存储目录。请看here.

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-05-31
        • 2013-06-05
        • 2019-05-02
        • 2018-06-27
        • 2018-10-20
        • 1970-01-01
        • 1970-01-01
        • 2019-08-22
        相关资源
        最近更新 更多