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?
config:clear
命令只是删除bootstrap/cache/config.php
文件,所以只需手动删除此文件。
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)
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/
尝试使用此命令一次清除所有缓存数据。
php artisan optimize:clear
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?
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.
This is very handy
composer require laracake/clearall --dev
After installation
php artisan laracake:clear
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
For Laravel > 7 because Laravel 5 is deprecated and the answers are not good enough.
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.