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 experienced this. Reason was that apache(user www-data) could not read .env due to file permissions.
So i changed the file permissions to ensure that the server (apache) had read permissions to the file. Just that and boom, it was all working now!
Update:
How to do this varies, depending on who owns the .env file, but assuming it belongs to the Apache www-data
group, you can do this:
sudo chmod g+r .env
Modify it depending on your permission structure.
For me the following worked
- php artisan config:cache
- php artisan config:clear
- php artisan cache:clear
Wow. Good grief. It's because I had an env value with a space in it, not surrounded by quotes
This
SITE_NAME=My website
Changed to this
SITE_NAME="My website"
Fixed it. I think this had to do with Laravel 5.2 now upgrading vlucas/phpdotenv from 1.1.1 to 2.1.0
run this:
php artisan config:clear
php artisan cache:clear
then
php artisan config:cache
When you fired command php artisan config:cache
then it will wipe out all the env
variables and env()
will give null values, try running following command and boom there your env()
again begin to catch all env
variable
php artisan config:clear
I had a similar issue in my config/services.php
and I solved using config clear
and optimize
commands:
php artisan config:clear
php artisan optimize