Never had an issue yet personally in local dev on windows and mac or production on various hosts. Weird.. I always take the defaults out though.
Laravel intermittently does not pull from environment variables correctly
Okay, so I am debugging some 500 internal server errors (which is frustrating enough), but then I ran into this occasional error:
PDOException in Connector.php line 47:
SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'forge'
I tracked it down, and it looks like what's happening is inside the database.php file where it specifies the host/database/username/password with a call like env('DB_DATABASE','forge'), Laravel is not pulling the environmental variable from the .env file and is instead using the default value (here it is set to 'forge').
Others are having the same issue as I am: https://laracasts.com/discuss/channels/general-discussion/issue-with-parallel-requests https://laracasts.com/discuss/channels/general-discussion/problem-with-env-file
What's frustrating is it's only 1/50 requests or so. I can force it to happen by doing a lot of AJAX calls quickly.
EDIT: Just found out that ALL of my 500 internal server errors are due to this. They weren't displaying the error for me because the 'debug' => env('APP_DEBUG', false); line in app.php was not correctly reading from the environmental variables either! When I hardcoded it to true in app.php, all of the 500 errors show the same error message above.
Please or to participate in this conversation.