After upgrading to Laravel 5.2, none of my .env
file values are being read. I followed the upgrade instructions; none of my config files were changed except aut
I missed this in the upgrade instructions:
Add an env configuration option to your
app.php
configuration file that looks like the following:'env' => env('APP_ENV', 'production')
Adding this line got the local .env
file to be read in correctly.
if you did call config:cache during local development, you can undo this by deleting the bootstrap/cache/config.php file. and this is work for me.
@Payal Pandav has given the comment above.
I want to tell a simple workaround. Just edit the config.php file in the bootstrap/cache/ folder. And change the credentials. This worked for me. Please don't delete this file since this may contain other crucial data in the production environment.
Tried almost all of the above. Ended up doing
chmod 666 .env
which worked. This problem seems to keep cropping up on the app I inherited however, this most recent time was after adding a .env.testing. Running Laravel 5.8
If any of your .env
variables contains white space, make sure you wrap them in double-quotes. For example:
SITE_NAME="My website"
Don't forget to clear your cache before testing:
php artisan config:cache
php artisan config:clear
if you did call config:cache during local development, you can undo this by deleting the bootstrap/cache/config.php file. and this is work for me.
In my case laravel 5.7 env('APP_URL')
not work but config('app.url')
works. If I add new variable to env
and to config - it not works - but after php artisan config:cache
it start works.