35

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
  • 37,241
  • 25
  • 195
  • 267
Wahyu Handy
  • 641
  • 2
  • 6
  • 12

6 Answers6

86

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

Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
19

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,264
  • 1
  • 12
  • 24
8

try this command for clear all cached data at once.

php artisan optimize:clear
Rahul Jat
  • 656
  • 1
  • 7
  • 14
1
because Laravel 5 is deprecated now, the answers are not good enough.

So I explain for Laravel > 7

I read all the answers but none of them contain optimize:clear so I want to write my answer for future users.

optimize:clear is the most powerful command to clean all the caches

in Laravel >= 7 you have this command for clearing all the caches

Command:

php artisan optimize:clear

It will clear: Compiled views, Application cache, Route cache, Configuration cache, Compiled services and packages.

It is not harmful at all. and it won't affect any single line of your codes. it just will clear all your cached files.

after running this command you will see:

Compiled views cleared!
Application cache cleared!
Route cache cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!
Raskul
  • 1,674
  • 10
  • 26
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
  • 5,781
  • 2
  • 20
  • 30