Laravel 5.2 not reading env file
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 auth.php. They were all working fine in previous version, 5.1.19
.env contains values such as
'mysql' => [ 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), ]
I get this error:
PDOException: SQLSTATE[HY000]  Access denied for user 'forge'@'localhost' (using password: NO)
Clearly not pulling in my env config. This is affecting every single one of my config files, including third party such as bugsnag.
I also tried
php artisan config:clear php artisan cache:clear
php artisan tinker
>>> env('DB_DATABASE') => null >>> getenv('DB_DATABASE') => false >>> config('database.connections.mysql.database') => "forge" >>> dd($_ENV) 
I have tried installing a fresh copy of Laravel 5.2. I basically only copied in my
app folder; no additional composer packages are included. Still having the same issue. I have other Laravel 5.2 projects on the same server that are working fine.
If any of your
.env variables contains white space, make sure you wrap them in double-quotes. For example:
Don't forget to clear your cache before testing:
php artisan config:cache php artisan config:clear
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?