【问题标题】:Laravel put contents in php file?Laravel 将内容放入 php 文件中?
【发布时间】:2017-03-22 09:50:04
【问题描述】:

我在一个 Laravel 实例中遇到了一个错误,上面写着:

[2016-11-08 16:48:19] prod.ERROR:ErrorException: file_put_contents(/theLaravelSite/bootstrap/cache/services.php): 无法打开流:权限被拒绝 /theLaravelSite/bootstrap/cache/compiled.php:7327

我以前见过这些错误,这些错误与storage 文件夹有关,但我对此有点困惑,因为它似乎说它试图将内容写入bootstrap/cache/services.php

知道如何解决这个问题吗?

【问题讨论】:

    标签: php laravel


    【解决方案1】:

    您应该递归设置bootstrap 文件夹的正确权限:

    chmod -R 775 bootstrap
    

    另外,检查bootstrap/cache 是否存在。如果不存在,请手动创建。

    【讨论】:

      【解决方案2】:

      将目录权限改为:

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

      根据Laravel Docs

      安装 Laravel 后,你可能需要配置一些权限。 storagebootstrap/cache 目录中的目录应该可以由您的 Web 服务器写入,否则 Laravel 将无法运行。如果您使用的是 Homestead 虚拟机,则应该已经设置了这些权限。

      【讨论】:

        猜你喜欢
        • 2017-03-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-09-09
        • 1970-01-01
        • 2022-12-03
        相关资源
        最近更新 更多