I followed this Git repo
Everything worked fine.
I can be able to issue php artisan varnish:flush
from SSH.
but when I tried to flush cache from script i was getting error as
sudo: no tty present and no askpass program specified
This is how I added in routes.php
Route::get('/flush', function() {
Artisan::call('varnish:flush');
});
and I also Tried
Route::get('/flush', function() {
(new Spatie\Varnish\Varnish())->flush();
});
This is how complete error looks.
ProcessFailedException in Varnish.php line 64:
The command "sudo varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 'ban req.http.host ~ (^www.host.com$)'" failed.
Exit Code: 1(General error)
Working directory: /home/admin/web/host.com/public_html
Output:
================
Error Output:
================
sudo: no tty present and no askpass program specified
I am using Vesta CP Over VPS.
Find Me A Solution to solve this error..