niko craft
niko craft

Reputation: 2977

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

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?

Upvotes: 4

Views: 2651

Answers (3)

Harjinder Kaur
Harjinder Kaur

Reputation: 1

You need to run route:clear, config:clear, and view:clear. After composer dump-autoload.

Upvotes: 0

shasi kanth
shasi kanth

Reputation: 7094

You can use this one command to clear all caches in Laravel:

php artisan optimize:clear

It would clear all the caches:

enter image description here

Upvotes: 0

Mohammed Aktaa
Mohammed Aktaa

Reputation: 1353

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

Upvotes: 6

Related Questions