'Laravel says application is in production but APP_ENV is local

My Laravel .env:

APP_ENV=local
APP_KEY=base64:7HjBWArUX989c8K87678687m2+6786876hs=
APP_DEBUG=true
APP_URL=http://localhost
...

I get the following message if I do php artisan env.

Current application environment: production

Even if I set the default environment to local in the app.php config file, the application still think it is in production. This is driving me nuts. Anyone knows why this is happening and how to fix it? I have run the clean cache commands, optimize commands, etc. I deleted the bootstrap folder content manually, and still nothing.



Solution 1:[1]

Are use already run:

php artisan config:cache
php artisan config:clear

?

Update

In my opinion, there are only two reasons why you get production. 1) Something is wrong in your config/app.php in this line: 'env' => env('APP_ENV', 'production'), 2) Or something is broken in your .env file. Make sure you really have an .env file. If there is nothing wrong in your env file. And if in your app.php file this line is correct: 'env' => env('APP_ENV', 'production')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1