【问题标题】:There is no existing directory at /storage/logs and its not buildable: Permission denied/storage/logs 中没有现有目录,并且它不可构建:权限被拒绝
【发布时间】:2018-12-05 01:48:27
【问题描述】:

我在 OVH Web 服务器上部署 Laravel 时遇到问题。 制作后

composer update

php artisan cache:clear

php artisan route:clear

php artisan dump-autoload

我有这个答案:
There is no existing directory at /storage/logs and its not buildable: Permission denied
我把所有文件都放在了 777 chmod 上,但我总是有这个答案。

【问题讨论】:

  • 作为对尝试此操作的任何人的说明,并且它不习惯于工匠命令或作曲家(我们都会不时犯同样的错误)命令是 composer dump-autoload,而不是 artisan : ) 干杯!
  • php 工匠转储自动加载?你可能的意思是“作曲家转储自动加载”
  • 就我而言,我只是在文件中忘记了;...所以请检查您是否在任何文件中都没有错误。

标签: laravel laravel-5 permissions


【解决方案1】:

请尝试以下命令

php artisan route:clear

php artisan config:clear

php artisan cache:clear

注意:如果您是 Homestead 和 VirtualBox 用户,请确保您的 VirtualBox 是最新的。

这有助于thread at laracasts

【讨论】:

  • 这个顺序(路由、配置、然后缓存)对我有用!
  • 对于最后一个命令:清除缓存失败。确保您拥有适当的权限。
  • Chanchal:给你stackoverflow.com/questions/52231248/…是一秒钟的搜索。
  • 这很好用......在我的情况下,它也是配置......但是有人明白潜在的问题是什么吗?是不是配置有问题?或配置缓存的构建方式出错(例如忽略 .env 或类似的东西?)似乎文件夹在那里,具有正确的权限等,所以有些东西似乎很臭,我只是不能指出它...
  • 只有耶稣知道为什么这与Redis error: cannot assign requested address 有关,但现在已修复。
【解决方案2】:

清除缓存和配置,然后部署到实时服务器。

如果您已经上传到直播服务器,那么您必须按照以下步骤操作:

  1. 删除bootstrap/cache/config.php
  2. 删除storage/logs中的所有日志文件。

【讨论】:

  • 共享主机的最佳答案??
  • 伟大的。为我工作以进行共享托管。
  • 我这样做了,它消除了此处问题中所述的错误,但随后我得到了 500 内部错误。有什么想法吗?
  • 太好了,谢谢!与 Docker 一起为我工作。
【解决方案3】:

您无需对存储文件添加任何权限。

  • 这里的主要问题是在编译文件中,因此 laravel 尝试显示错误。
  • 在laravel默认情况下,存储文件无权在控制台显示(错误 从 error.log 文件中显示)。
  • 所以你需要修复的是修复编译文件。这可以通过这个单一的命令来完成

此命令将清除所有缓存

- Compiled views
- Application cache
- Route cache
- Configuration cache

使用这个

php 工匠优化:清除

【讨论】:

  • ? 你是救生员!我遇到了一些愚蠢的 CORS 问题并通过命令解决。
  • 我很高兴它有帮助。 @AmirrezaNasiri 也感谢您的评论。
  • 工作,即使它说“无法清除缓存。确保您拥有适当的权限。” :-)
【解决方案4】:

更改本地配置后,我一遍又一遍地遇到相同的错误, 试试这个,可能会有帮助。

rm bootstrap/cache/config.php

然后

php artisan cache:clear

根据您的情况,重新加载自动加载器文件可以解决您的问题,用于该用途:

composer dump-autoload

或者有时只是尝试:

composer install

这会执行上面列出的两个命令。

【讨论】:

  • 这解决了问题。非常感谢!
  • 只是删除配置文件并清除缓存对我有用(不需要作曲家命令)。谢谢帮助
【解决方案5】:

去找你的流浪汉

然后运行

流浪的ssh

php 工匠配置:缓存

【讨论】:

  • 您能否详细介绍一下这样做的效果
  • 首先你需要运行你的 vagrant env,然后你应该使用 vagrant ssh 连接到它的 bash 脚本,配置缓存将清除缓存的配置文件,然后重建它们。
【解决方案6】:

如果您在 Laravel 中使用宅基地(流浪者),请按照@Farid shahidi 提供的步骤操作

vagrant ssh
cd /home/vagrant/code <-- your file usually resides here; see your Homestead.yaml configuration
php artisan config:cache

【讨论】:

  • 如果您使用 vagrant/docker/etc,请确保在机器内部运行php artisan config:cache
【解决方案7】:

如果您可以访问您的服务器终端,请运行以下命令

php artisan route:clear && php artisan cache:clear && php artisan config:clear && php artisan config:cache

如果您在共享主机上并且无法访问终端,请转到routes/web.php 中的网络路由文件并创建一个临时链接,如下所示:

Route::get('reset', function (){
    Artisan::call('route:clear');
    Artisan::call('cache:clear');
    Artisan::call('config:clear');
    Artisan::call('config:cache');
});

然后去http://your-domain/reset执行命令。之后您现在可以正常访问您的网站了

【讨论】:

    【解决方案8】:

    你必须以这种方式尝试工匠命令

    1. php artisan cache: clear
      
    2. php artisan config:cache
      
    3. php artisan cache: clear
      

    【讨论】:

    • 谢谢!这对我帮助很大!
    【解决方案9】:

    请运行以下命令:

    php artisan route:clear
    php artisan config:clear
    php artisan cache:clear
    

    【讨论】:

      【解决方案10】:

      如果您的项目位于 /var/www/html/ 内,这个对我有用

      sudo chmod -Rf 0777 /var/www/html/{project-name}/bootstrap/cache sudo chmod -Rf 0777 /var/www/html/{project-name}/storage

      【讨论】:

        【解决方案11】:

        您需要从终端运行此命令。

        php artisan config:clear
        php artisan config:cache
        

        【讨论】:

          【解决方案12】:

          从服务器上的 laravel 部署中删除 bootstrap/cache/config.php。

          【讨论】:

            【解决方案13】:

            我遇到了同样的问题,我更改了存储文件夹中文件夹的权限。

            chmod 777 &lt;folder_name&gt;

            我不确定这种安全性。但这解决了我的问题。

            我将文件设置更改为755 也适用于我。

            【讨论】:

            • 使用777 权限是一个非常糟糕的权限,它有很多安全问题,因为它给每个人RWX 权限!
            • @FarbodAhmadian 谢谢,我将权限更改为 755 也适用于我。在您发表评论后,我也会编辑我的上述答案。
            【解决方案14】:

            试试这个

            1. 删除您的“供应商”文件夹
            2. 在您的 cmd 或终端上运行“composer install”或“c​​omposer install --ignore-platform-reqs”
            3. php 工匠配置:缓存
            4. php 工匠配置:清除
            5. php artisan 缓存:清除
            6. php 工匠路线:缓存
            7. php 工匠视图:清除
            8. php 工匠配置:缓存

            如果您使用的是 linux:

            1. service apache2 重启(以防万一)

            如果你使用 xammp:

            1. 只需重新启动您的 xammp

            【讨论】:

              【解决方案15】:

              这一行命令解决了我的问题:

              php artisan config:cache
              

              【讨论】:

                猜你喜欢
                • 2022-06-11
                • 2019-07-20
                • 1970-01-01
                • 2021-01-22
                • 2020-02-12
                • 2021-10-07
                • 2019-07-24
                • 2018-09-07
                • 1970-01-01
                相关资源
                最近更新 更多