Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Laravel 5 from caching configurations?

Tags:

laravel-5

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.

like image 695
wessodesigner Avatar asked Apr 19 '15 11:04

wessodesigner


People also ask

Where is Laravel config cache?

The cache configuration is located at config/cache. php . In this file you may specify which cache driver you would like used by default throughout your application. Laravel supports popular caching backends like Memcached and Redis out of the box.

How do I disable cache in Laravel 8?

To disable the cache you have to add the following to your config/cache. php file. 'stores' => [ //... 'none' => [ 'driver' => 'null', ], ], Now you have to change your CACHE_DRIVER value to none in your .

How do I clear the config cache in Laravel on a server?

To clear all Laravel's cache, just run the following command: $ php artisan optimize:clear Compiled views cleared! Application cache cleared!


1 Answers

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.

like image 127
lukasgeiter Avatar answered Sep 30 '22 17:09

lukasgeiter