This question already has answers here:
Laravel - What does php artisan view:clear do?
(1 answer)
In Laravel, what is meant by the term "clear compiled class"
(1 answer)
Difference between "php artisan config:cache" and "php artisan cache:clear" in Laravel
(2 answers)
Closed 12 months ago.
Just as I was getting ready to run:
php artisan cache:clear
php artisan view:clear
php artisan route:clear
...for debugging purposes, I ended up running php artisan clear instead. I got back the following output:
Compiled services and packages files removed!
What have I just done and how do I undo it? My application still seems to work fine, but if things are broken I'd rather roll things back now rather than get further down the line before I eventually realise that they are. If things aren't broken, I'd still like to know what I just did.
A preliminary answer before someone who can do more than read through the help commands comes along:
Although:
php artisan clear
...isn't listed in artisan's documentation at all (or at least not in php artisan list), based on its output it seems to be an alias of:
php artisan clear-compiled
This seems to be confirmed by php artisan help clear-compiled:
Description:
Remove the compiled class file
Usage:
clear-compiled
Although that help command doesn't really clear up much, like what exactly compiled class files are or what relation they have to any of the other clear commands, I'm guessing the command does something similar to:
php artisan view:clear
...which does the following according to its own help command:
Description:
Clear all compiled view files
Usage:
view:clear
Based on the above, I can only guess that running php artisan clear is about as harmless as running php artisan view:clear, in that both are designed to clear away compiled files that, when cleared, are simply recompiled again on the next build.
How exactly php artisan clear differs from php artisan view:clear and why it needs its own separate command and a much more memorable alias than any of the other clear commands is still... unclear.
BONUS
To anyone else that arrived here because they find themselves constantly running some variation of the above commands for debugging and troubleshooting, I just learnt about the php artisan optimize:clear command, which runs all of these commands at once:
php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan clear
and returns the following output:
Compiled views cleared!
Application cache cleared!
Route cache cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!
Related
I have a log inside one of Laravel Jobs that I've already removed a few days ago. Today I checked and the log is still showing even though it's no longer in the code. I checked manually and it is indeed gone from the server file. So I'm wondering why this is happening and does this mean every time I do an update I have to do the ff:
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
Is Laravel doing this or could be a server cache?
If it is server cache where can I find the config for it?
We're using Ubuntu 20.04.5 LTS and nginx
PHP v8.0
Laravel v9.37.0
I have a Laravel app running behind an Apache2/Ubuntu-16.04. I have to change a little code line in my controllers ( .i.e. a typo mistake in
laravel_project/app/Http/Controller/MyController.php). But when I reload the webpage using the browser, it still doesn't update with my fixed version. I tried some cleanup commands:
php artisan config:cache
php artisan route:cache
php artisan list
php artisan clear-compiled
and also restart apache2 but it still doesn't work. Can you please help me. Thanks.
I had the same issue, its was because of routes cache
I resolved it by:
php artisan route:clear
I have 2 laravel apps.
On typing: "time php artisan" in first app, I see:
real 0m0.328s
user 0m0.123s
sys 0m0.057s
And if type the same at my "problem" project, I see:
real 1m15.887s
user 0m0.220s
sys 0m0.085s
I try to:
php artisan cache:clear
php artisan config:clear
php artisan debugbar:clear
php artisan route:clear
php artisan view:clear
composer said, that I have
laravel/framework v5.6.26 The Laravel Framework.
I try to drop "vendor" directory, and to run composer install command
it also doesn't helps. What should i do to fix so long time execution? php v 7.1.4
Few hours ago everything was ok! I was working only with controllers, (no any new artisan commands was made before bug shows)
~75sec for blank artisan coomand execution to show only commands list is too much...
I realy appreciate for any suggestions.
My IDE is phpstorm and running on WAMP Server. While coding, it does not show the expected response, always returns the previously requested response (In postman). Each time, I need to close 'php artisan serve' with CTRL+C and then run again to get the expected response.
I tried changing IDE, changing port but it does not work. Of course, I tired to save manually ( CTRL+S) but the problem persists.
I also tried the following commands:
php artisan cache:clear
php artisan config:clear
php artisan route:clear
composer dump
But the problem still persists.
The issue might be the composer command. Please, have a look on my setup in the Makefile:
run:
php artisan config:cache
php artisan config:clear
php artisan cache:clear
composer.phar dump-autoload -o
php artisan serve
And it's ready to go with a Laravel's "clean build".
Can you try with a diferent request tool, like doing a GET on your browser?
Or just create a new endpoint to test that. This way you make sure that changes are being saved.
I recommend you make tests to see if:
the problem is on your postman (a cache maybe?);
the problem is that your code isn't being saved;
the problem is on your local server (a persistent cache?);
My tip is: Try to eliminate the possible causes and you should achieve an answer.
Let´s try to make sure about above items and if them are ok, we check possible another ones.
I am trying to setup a deployment script for my Laravel 5 app to use with CodeShip but I am having issues with clearing the application cache during the deployment.
By running
php artisan cache:clear
it does not give any errors and says the cache has been cleared but it hasnt, then when I ssh into the box and try to delete the cache manually it says permission is denied, so I need to use sudo which is not ideal as Id like to have this all to run without my intervention. I know this is a permissions issue but I cannot work out a way around it.
Is there a way I can do this or maybe a slightly different method?
You shouldn't delete cache manually. Try to run these commands:
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear
composer dump-autoload
Try php artisan config:cache
This will do it all for you.
Hope this helps!