Laravel 8无法清除缓存.请确保您拥有适当的权限



我正在运行php artisan cache:clear以通过SSH清除Godaddy共享主机中的缓存。

我的其他artisan命令工作,但php artisan cache:clear不工作。

我得到以下错误:

Failed to clear cache. Make sure you have the appropriate permissions.

我通过删除bootstrap/cache.中的所有文件解决了这个问题。然后,运行以下命令。

php artisan cache:clear
composer dump-autoload

执行php artisan cache:clear的用户必须递归地对以下目录和内容具有写入权限。

booststrap/cache/*
storage/*

检查用户没有写入权限的文件

find booststrap/cache storage -not -perm -u=w

最终修复权限:

chmod -R u+w bootstrap/cache storage

您还可以使用Artisan facade清除实时服务器/生产中的缓存。

Artisan::call('cache:clear');

相关内容

最新更新