Laravel 5.2 not reading env file
Solution 1:
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
Solution 2:
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