1

I am running php artisan cache:clear to clear the cache in Godaddy shared hosting through SSH.

My other artisan commands working but php artisan cache:clear not.

I am getting following error :

Failed to clear cache. Make sure you have the appropriate permissions.
Dhairya Lakhera
  • 3,932
  • 3
  • 27
  • 47
  • make sure `bootstrap/cache` folder have correct permission `read/write` – Kamlesh Paul Sep 28 '20 at 10:26
  • Make sure that your user has correct permissions on `storage/cache` folder. If not take a look on this question and give correct permissions. https://stackoverflow.com/questions/30639174/how-to-set-up-file-permissions-for-laravel – Malkhazi Dartsmelidze Sep 28 '20 at 10:27

3 Answers3

0

You can also user Artisan facade to clear cache in live server/production.

Artisan::call('cache:clear');
Niklesh Raut
  • 31,857
  • 10
  • 68
  • 102
0

The user that executes php artisan cache:clear must have write permissions on the following directories and content recursively.

booststrap/cache/*
storage/*

To check files that user does not have write permission for

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

Finally fix permissions:

chmod -R u+w bootstrap/cache storage
8ctopus
  • 1,229
  • 1
  • 9
  • 19
0

I fixed this issue by deleting all files in bootstrap/cache. Then, run the following commands.

php artisan cache:clear

composer dump-autoload
Karl Hill
  • 9,745
  • 4
  • 52
  • 77
Razor Mureithi
  • 163
  • 1
  • 3
  • 12