Environmental file cached in laravel?

sanzeeb3_18 profile image Sanzeeb Aryal Updated on ・1 min read

Are you having issues with .env and config/app.php not taking effect on deployment environment? The configuration files might have been cached, you might be caching the configuration with:

php artisan config:cache

However, you are doing it right. According to the documentation:

To give your application a speed boost, you should cache all of your configuration files into a single file using the php artisan config:cache Artisan command. This will combine all of the configuration options for your application into a single file which will be loaded quickly by the framework

You should typically run the php artisan config:cache command as part of your production deployment routine. The command should not be run during local development as configuration options will frequently need to be changed during the course of your application’s development.

So, make sure you are caching the configuration files on deployment environment. Or, you can clear the cache during the development process with

php artisan config:clear and php artisan cache:clear

and modify the .env and config/app.php from deployment environment.

Posted on by:


Editor guide