framework: [L5.7] Cache clear fails

  • Laravel Version: 5.7.1
  • PHP Version: 7.2.9
  • Database Driver & Version: MariaDB 10.2.16.

Description:

Attempting to clear app cache returns an error message: Failed to clear cache. Make sure you have the appropriate permissions.

Steps To Reproduce:

$ php artisan cache:clear

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 27
  • Comments: 32 (11 by maintainers)

Most upvoted comments

@alkapatel If you’re using the file store driver, create the storage/framework/cache/data directory manually.

@tramel-woodard , @elias-alea you need to create storage/framework/cache/data directory manually like @AegirLeet said.

For me

php artisan cache:clear

command worked after

php artisan config:cache

command. It worked 😕

Use this package, It will tackle all cache and clean it properly.

https://github.com/rakshitbharat/cleanify

I don’t understand why I am directed to read the documentation and/or upgrade guide when the framework could just as easily (re)create folders, particularly cache file locations, that it requires to exist, if they aren’t present. The fact that Laravel developers need several empty folders to exist in the repository with a .gitignore only is kind of silly. Why doesn’t php artisan cache:clear just create these folders if they don’t exist but are required for the framework to operate?

por los que aun tienen el problema del cache yo lo solucione como dice la guia de instalacion, use lo siguiente: mkdir -p storage/framework/cache/data; y luego cp storage/framework/cache/.gitignore storage/framework/cache/data/.gitignore y listo ya esta con esto

@alterman1994 I would chown it and/or chmod it (recursively) if needed, to the user running artisan command. If it got created by www-data, it can give permissions issue when running as logged in user. On our servers (Ubuntu) we add ubuntu, root, www-data to www-group and chown group ownership to www-group. HTH-

Just only add folder name “data” in storage/framework/cache/ and try php artisan cache:clear.

The upgrade guide has now a reference to the missing data/ directory (section “Cache”)

@elias-alea If you install laravel now, you will get storage/framework/cache/data directory automatically so you don’t have to create it. They leave this directory to allow the filesystem to cache.

This solved issue for me 😃

mkdir storage/framework/cache/data

Laracasts source via @bobbybouwmann

@taylorotwell closed this but a fresh install of laravel 5.7 today gave me this same issue. What am I missing?

php artisan cache:clear works fine for me, but with any option it doesnt. php artisan cache:clear --tags=views fails with the message Failed to clear cache. Make sure you have the appropriate permissions. Tried adding the data directory, but that does not help.

I am using redis for all caches.