30

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?

Cœur
  • 34,719
  • 24
  • 185
  • 251
Wahyu Handy
  • 571
  • 2
  • 5
  • 12

6 Answers6

76

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

Alexey Mezenin
  • 148,626
  • 22
  • 267
  • 261
  • This answer (https://stackoverflow.com/a/43446010/1085499) solved my problem after going through all other solutions. – Mohal Feb 01 '18 at 07:15
17

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)

321zeno
  • 1,234
  • 1
  • 13
  • 24
13

Try also

for command line

php artisan config:cache

using artisan commands

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

https://www.tutsmake.com/laravel-clear-cache-using-artisan-command-cli/

Developer
  • 810
  • 10
  • 6
5

try this command for clear all cached data at once.

php artisan optimize:clear
Rahul Jat
  • 517
  • 6
  • 12
0

Here it is nice tiny library for shared hosting and typing clear bunch of clear commands one by one..

simply just install it once, and clear all caching issues in laravel with just one command.

Laracake

This is very handy

composer require laracake/clearall --dev

After installation

php artisan laracake:clear
0

This is how I restart queue server on live

## Restart redis and terminate curent jobs
php artisan config:clear ## clear config
sudo -i
cd /var/www/html
php artisan horizon:terminate ## need to be sudo , else throw permission error
php artisan queue:restart
exit
Florin
  • 4,997
  • 2
  • 19
  • 30