how to clean Laravel Bootstrap cache config file?

I just stumbled into this while building automated deployment in AWS. The problem with Laravel is that artisan commands also use the cache. Now if you deploy the new version of your application you may have outdated entries in the cache which in turn will make the artisan command crash i.e. cannot find some class that was cached but no longer exist. Therefore you either need to:

  1. Clear cache before you deploy the application
php artisan cache:clear
  1. Clear cache manually
rm -rf bootstrap/cache/*.php

Finally you want to run optimize command which will re-build your configuration cache, bootstrap file cache and route caches.

php artisan optimize

I tried all the above options but nothing works.

I manually removed from bootstrap/cache/config.php. And it works. This is the Ultimate solution.


If you are trying to clear configuration cache, which it sounds like you are. You need to run:

php artisan config:clear

At some point, you probably ran php artisan config:cache which generated a cached version of your config file, and this file is not cleared with php artisan cache:clear

Tags:

Mysql

Php

Laravel