Laravel .env File Changes Not Detected
When upgrading to Laravel 5.2, users occasionally encounter issues with modified .env file values not being recognized. If you have encountered this issue, follow these steps to resolve it:
Check .env Variables
Ensure that all .env variables, particularly those with whitespace, are enclosed in double quotes. For instance:
SITE_NAME="My website"
Clear Cache
After modifying the .env file, clear the cache to reload the modified values:
php artisan config:cache php artisan config:clear
Running php artisan tinker and checking env('DB_DATABASE') should now return the correct value from the .env file. Additionally, config('database.connections.mysql.database') should display the updated database name.
The above is the detailed content of Why Aren't My Laravel 5.2 .env File Changes Being Detected?. For more information, please follow other related articles on the PHP Chinese website!