'Laravel 8 Failed to clear cache. Make sure you have the appropriate permissions [duplicate]

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.


Solution 1:[1]

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

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

Solution 2:[2]

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

Solution 3:[3]

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

php artisan cache:clear

composer dump-autoload

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Niklesh Raut
Solution 2 8ctopus
Solution 3 Karl Hill