Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.3 - Clear config cache in shared hosting

Currently I'm working on small project that require me to host my laravel app on shared hosting (please ignore the reason why I didn't use VPS to host my laravel project) and this hosting provider disable escapeshellarg() for security reason so I can't use php artisan config:cache to clear config cache.

Is there any workaround for this?

like image 238
Wahyu Handy Avatar asked Jan 07 '17 13:01

Wahyu Handy


People also ask

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! Route cache cleared!

How do I run php artisan config cache in cPanel?

Run php artisan config:cache in terminal of your project root directory. First try to get access of terminal on from hosting provider. Then run php artisan config:cache command in your project root directory. If you don't have terminal access the follow this trick.


2 Answers

config:clear command just deletes bootstrap/cache/config.php file, so just delete this file manually.

like image 113
Alexey Mezenin Avatar answered Oct 25 '22 13:10

Alexey Mezenin


You can call artisan commands programmatically

Artisan::call('config:clear'); 

This can be helpful in setups where the PHP user has a different set of permissions than the FTP user (so files created by PHP cannot be deleted via FTP)

like image 31
321zeno Avatar answered Oct 25 '22 11:10

321zeno