Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Always have to clear cache in .env?

Tags:

I am having a cache issue. I have a project and worked on local. Now whenever i upload to server and edit the .env and config/app.php file. It is not taking the effect.

But, if i set the .env configuartions of server in local and cleared the cache using php artisan config:cache and upload it to server. It works. Should i always do this method?

So everytime i need change .env i should first change it in local and clear the cache and upload in server? Or is there any method to directly command on server.

And again, in another project. Editing .env and config/app.php file directly in server takes immediate effect. What is happening?

like image 844
Steve Avatar asked Mar 26 '17 07:03

Steve


People also ask

What does PHP artisan config cache do?

php artisan config:cache This command clears the cached config file as mentioned above and recaches the latest configurations into a single file again.


1 Answers

Check APP_ENV in your .env file. If it's on production then yes, laravel caching it. You should run these commands before changing configs:

php artisan cache:clear php artisan config:clear php artisan route:clear 

And then after changes run these:

php artisan config:cache php artisan route:cache php artisan optimize 
like image 129
MoPo Avatar answered Nov 11 '22 11:11

MoPo