【问题标题】:Laravel 'sudo: no tty' error on Artisan::call when clearing cache from varnish从清漆清除缓存时,Artisan::call 上的 Laravel 'sudo: no tty' 错误
【发布时间】:2017-06-11 12:42:51
【问题描述】:

我关注了这个Git repo

一切正常。

我可以通过 SSH 发出php artisan varnish:flush

但是当我试图从脚本中刷新缓存时,我得到了错误

sudo:不存在 tty,也没有指定 askpass 程序

这就是我在 routes.php 中添加的方式

Route::get('/flush', function() {
    Artisan::call('varnish:flush');
});

我也试过了

Route::get('/flush', function() {
    (new Spatie\Varnish\Varnish())->flush();
});

这是完全错误的样子。

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

我在 VPS 上使用 Vesta CP。

为我找到解决此错误的解决方案..

【问题讨论】:

    标签: linux laravel ssh sudo tty


    【解决方案1】:

    使用sudo 时,该命令会打开文件夹/dev/tty 进行读写,如果失败则打印该错误。

    如果文件夹被删除,重新启动您的计算机就足以恢复该文件夹。系统在启动期间重新创建 /dev 中的所有设备。

    另外,请确保权限正确:

    chmod 666 /dev/tty

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-28
      • 2018-04-07
      • 2013-01-09
      • 2012-08-07
      • 2012-09-20
      • 2012-04-20
      • 2016-12-17
      • 1970-01-01
      相关资源
      最近更新 更多