【发布时间】:2016-10-01 21:38:03
【问题描述】:
使用腻子我可以连接。但是使用 PHP 我不能。我不知道,为什么会这样?我在 PHP 中安装并启用了扩展 ssh2。
我使用了以下代码:-
$ssh2 = ssh2_connect('myhost');
if (false === $ssh2) {
die('connection failed');
}
$auth = @ssh2_auth_password($ssh, "hostusername", "hostpassword");
if (false === $auth) {
die('authentication failed');
}
echo ssh2_exec($ssh2,'pwd');
但这会出现以下错误: 警告:ssh2_exec():连接未通过身份验证
【问题讨论】: