【问题标题】:Call to undefined function ssh2_connect() in laravel在 laravel 中调用未定义的函数 ssh2_connect()
【发布时间】:2019-08-23 06:52:35
【问题描述】:

我尝试在我的应用程序中运行 SSH 连接并收到此错误:

Call to undefined function App\Http\Controllers\Admin\ssh2_connect()

Controller

public function save(Request $request){
        $ip = $request->input('server_ip');
        $sshUser= $request->input('server_ssh_user');
        $sshPw = $request->input('server_ssh_password');

        $sshConnection = ssh2_connect($ip, 22);
        //rest of the code which doesn't execute as result of line above returns error

有什么想法吗?

【问题讨论】:

标签: php laravel ssh


【解决方案1】:

您需要在服务器上安装以下软件包。

Ubuntu/Debian:

sudo apt-get install php-ssh2
sudo service apache2 restart

Redhat/Centos/Amazon-Linux:

sudo yum install php-ssh2 
sudo service httpd restart (Centos/Redhat/AmazonLinux)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-03
    • 2016-10-03
    • 2016-03-30
    相关资源
    最近更新 更多