astersnake's avatar

Laravel says application is in production but APP_ENV is local

So that it's:

My laravel .env:

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

If I do php artisan env I get the following message: Current application environment: production

I have use every single clear command that exist in this universe.

Even if I set the default environment to local in app.php config file, the application still think is in production. This is drving me nuts, anyone knows why this is happening and how to fix it?

0 likes
6 replies
jlrdw's avatar

Mine shows correct, try to config:clear.

jlrdw's avatar

@astersnake in your config app file, is it:

'env' => env('APP_ENV', 'production'),

Or has it been modified? Also delete the bootstrap cache files, but not .gitignore.

astersnake's avatar

@jlrdw

'env' => env('APP_ENV', 'production') is my app file, I replaced production for local but nothing happened so I returned back to production.

I deleted manually bootstrap files and nope, Laravel keeps saying it's in production.

the config.php in bootstrap folder:

<?php return array (
  'app' => 
  array (
    'name' => 'Project',
    '.env' => 'local',
    'debug' => true,
    'url' => 'http://localhost',
    'asset_url' => NULL,
...
folium's avatar

@astersnake try below code after doing local to your env.

php artisan optimize

and then

php artisan serve
Snapey's avatar

I often check my sanity by firing up tinker and running config(....) to see the config as the app sees it

Please or to participate in this conversation.