How do I get the “php artisan cache: clear” command to work?
How do I get the “php artisan cache: clear” command to work?
I'm using a Mac. Can not execute the command
php artisan cache: clear
I get in return:
Failed to clear cache. Make sure you have the proper permissions.
This is for Laravel. Any ideas how to fix this?
execute pront with super admin and try
– Alexander Villalobos
Sep 4 '18 at 20:27
Is your
storage/framework/cache
folder set with the correct permissions? This started changing for me recently too when I had to run composer
commands (such as composer create-project laravel/laravel
) as root
vs current user.– Tim Lewis
Sep 4 '18 at 20:27
storage/framework/cache
composer
composer create-project laravel/laravel
root
storage/framework/cache this folder is empty. Is it not normal?
– Vd A
Sep 4 '18 at 20:32
run yout cdm pront inside folder with super admin and try you have all permissions
– Alexander Villalobos
Sep 4 '18 at 20:47
3 Answers
3
This could be one of several things(need more information to narrow it down):
Expansion on points 1 and 2:
This is normal behavior. If you have opened pages expecting them to be cached and they are not, split the page and utilize @include
directives splitting out the dynamic and static elements of the page into separate blade files.
@include
I like to add my user to the same group as the web server's group(www). Then change the group for all of the files to www, with group read permissions, and write permissions only on the bootstrap/cache
and storage
directories.
bootstrap/cache
storage
@GeorgeHanson Any failure to delete files in 5.7 results in the message: $successful = $this->cache()->flush(); $this->flushFacades(); if (! $successful) { return $this->error('Failed to clear cache. Make sure you have the appropriate permissions.'); This is not a bug, just a change in the message. It used to ignore empty directories.
– Strom
Sep 4 '18 at 22:05
I think it might possibly be a bug with the latest version of Laravel, however unlikely it may seem. I started a new project today and installed a fresh copy of Laravel 5.7 and it seems to cause the error above. However, if I use 5.6 then the error does not appear.
create storage/framework/cache/data directory manually.
Many thanks you
– Vd A
Oct 2 '18 at 20:17
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Previously, this operation has always worked. Now I have created a new project as usual. And the first time I received this error.
– Vd A
Sep 4 '18 at 20:22