我正在开发一个游戏服务器托管面板,我试过这个:
$ssh = ssh2_connect('xx.xx.xx.xx', 22);
if(ssh2_auth_password($ssh, 'user', 'userpass'))
{
echo 'Success';
}
else
{
die('Fail');
}
但它只是不显示任何消息(成功/失败)。 我怎样才能使这个连接工作? ><
最佳答案
您可能没有安装 libssh2 扩展。安装它非常痛苦,因此我建议您使用此工具:
https://github.com/phpseclib/libssh2-compatibility-layer
将其包含在文件顶部,即使未安装 libssh2,您的所有 libssh2 函数调用也应该有效。
关于php - 如何使用 PHP 连接到 Linux?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25190548/