Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Laravel from caching ENV file, is there a way?

Tags:

laravel

I discovered that I can't change something in the .env file and have Laravel pick it in next run. For example I changed

APP_ENV=production

to

APP_ENV=local

And upon running

artisan migrate

I still get asked if I am sure I want to run migration in production environment. Is there a way to get around this and not have to clear cache every time .env file is updated?

like image 278
niko craft Avatar asked Nov 16 '25 16:11

niko craft


1 Answers

you need to run config:clear and cache:clear.

like image 109
Mohammed Aktaa Avatar answered Nov 18 '25 11:11

Mohammed Aktaa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!