I developed laravel app locally and uploaded in shared hosting.
While hosting I changed the database name and username of mysql in the .env and the config/database files.
But in remote its still using the old db name and user which is found in the bootstrap/cache/config file.
So how to clean the bootstrap/cache/config.php file?
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 withphp artisan cache:clear
Use
php artisan cache:clear
to flush the application's cache.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 new version of your application you may have outdated entries in the cache which in turn will make the artisan command to 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
2) Clear cache manually
Finally you want to run optimize command which will re-build your configuration cache, bootstrap file cache and route caches.
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.
You can use:
Laravel 4 :
php artisan cache:clear
also for laravel 5(not tested),
Illuminate\Cache\FileStore
has the functionflush
also,
Or you can just manually delete bootstrap/config.php, which is what artisan does after all.
See: vendor\laravel\framework\src\Illuminate\Foundation\Console\ConfigClearCommand.php