Laravel 5 – Clear Cache in Shared Hosting Server
Go to laravelFolder/bootstrap/cache
then rename config.php
to anything you want eg. config.php_old
and reload your site. That should work like voodoo.
You can call an Artisan command outside the CLI.
Route::get('/clear-cache', function() {
$exitCode = Artisan::call('cache:clear');
// return what you want
});
You can check the official doc here http://laravel.com/docs/5.0/artisan#calling-commands-outside-of-cli
Update
There is no way to delete the view cache. Neither php artisan cache:clear
does that.
If you really want to clear the view cache, I think you have to write your own artisan
command and call it as I said before, or entirely skip the artisan
path and clear the view cache in some class that you call from a controller or a route.
But, my real question is do you really need to clear the view cache? In a project I'm working on now, I have almost 100 cached views and they weight less then 1 Mb, while my vendor
directory is > 40 Mb. I don't think view cache is a real bottleneck in disk usage and never had a real need to clear it.
As for the application cache, it is stored in the storage/framework/cache
directory, but only if you configured the file
driver in config/cache.php
. You can choose many different drivers, such as Redis or Memcached, to improve performances over a file-based cache.