如何使用PHP连接到Linux?

hivapdat  于 2023-05-06  发布在  Linux
关注(0)|答案(1)|浏览(95)

我在一个游戏服务器托管面板上工作,我已经尝试过这个:

$ssh = ssh2_connect('xx.xx.xx.xx', 22);
        if(ssh2_auth_password($ssh, 'user', 'userpass'))
        {
            echo 'Success';
        }
        else
        {
            die('Fail');
        }

但它只是不显示任何消息(成功/失败)。我如何才能使这种连接工作?〉〈

mbjcgjjk

mbjcgjjk1#

您可能没有安装libssh2扩展。这是一个相当大的痛苦安装它,所以我会建议你使用这个工具:
https://github.com/phpseclib/libssh2-compatibility-layer
包括在文件顶部,那么即使没有安装libssh2,所有libssh2函数调用也应该可以工作。

相关问题