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
delete cache using:
php artisan config:clear
php artisan config:cache
From the official Laravel 5.2 Upgrade Notes:
If you are using the
config:cache
command during deployment, you must make sure that you are only calling theenv
function from within your configuration files, and not from anywhere else in your application.If you are calling
env
from within your application, it is strongly recommended you add proper configuration values to your configuration files and callenv
from that location instead, allowing you to convert yourenv
calls toconfig
calls.
Reference: https://laravel.com/docs/5.2/upgrade#upgrade-5.2.0
I made the mistake by doing dd/die/dump in the index.php
file. This causes the system to not regenerate the configs.
Just do dump in view files will do. The changes to .env
file update instantly.
I ran into this same problem on my local, and I have tried all the answers here but to no avail. Only this worked for me,
php artisan config:clear
and restart server
. Works like a charm!
If you run this php artisan config:cache
command on console then it will store all the .env file contents in cache, after this command if you append any contents into .env file the it will not be not be available until you run php artisan config:clear
command
For me it has worked this in this order:
php artisan config:cache
php artisan config:clear
php artisan cache:clear
And I've tried all the rests without luck.