Monday 7 January 2019

How to stop Laravel 5 from caching configurations?



It is written in Laravel 5 documentation that php artisan config:cache stores all the app configuration into one single file which makes the application load faster.



I want to know two things:



The first thing is, how to force Laravel to stop caching my app configurations? For example, I want Laravel to read the name of my database and the password from the .env file or from the database.php configuration file, not from the cached data.




The second thing is, where does Laravel store this cached configuration file, so that I can delete it when needed? I know there is an Artisan command for that, which is php artisan config:clear, but I want to know where the file stored.


Answer



You can't stop the caching of config files since it doesn't happen automatically. The only thing you need to do, is not call config:cache.



The file itself can be found in bootstrap/cache/config.php.



Note that the location of the compiled config file has changed recently. Yours might also be in vendor/config.php or storage/framework/config.php. With a fresh install or if you run composer update the file should be in bootstrap/cache though.


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...