我在一个游戏服务器托管面板上工作,我已经尝试过这个:
$ssh = ssh2_connect('xx.xx.xx.xx', 22);
if(ssh2_auth_password($ssh, 'user', 'userpass'))
{
echo 'Success';
}
else
{
die('Fail');
}
但它只是不显示任何消息(成功/失败)。我如何才能使这种连接工作?〉〈
1条答案
按热度按时间mbjcgjjk1#
您可能没有安装libssh2扩展。这是一个相当大的痛苦安装它,所以我会建议你使用这个工具:
https://github.com/phpseclib/libssh2-compatibility-layer
包括在文件顶部,那么即使没有安装libssh2,所有libssh2函数调用也应该可以工作。