【发布时间】:2014-09-18 07:12:11
【问题描述】:
所以我从 php.net 拿了一个例子来看看 php ssh2 的工作原理
所以代码是
<?php
$connection = ssh2_connect('shell.example.com', 22);
if (ssh2_auth_password($connection, 'username', 'secret')) {
echo "Authentication Successful!\n";
} else {
die('Authentication Failed...');
}
?>
当我输入错误信息时,它会给我一些错误,而不是告诉我身份验证失败。
错误是
Warning: ssh2_connect(): php_network_getaddresses: getaddrinfo failed: Name not known in
/var/zpanel/hostdata/zadmin/public_html/whothehellcareswhatisthis/ssh2.php on line 2 Warning: ssh2_connect(): Unable to connect to
shell.example.com on port 22 in /var/zpanel/hostdata/zadmin/public_html/whothehellcareswhatisthis/login/ssh2.php on
line 2 Warning: ssh2_connect(): Unable to connect to shell.example.com in
/var/zpanel/hostdata/zadmin/public_html/whothehellcareswhatisthis/login/ssh2.php on line 2 Warning:
ssh2_auth_password() expects parameter 1 to be resource, boolean given in /var/zpanel/hostdata/zadmin/public_html/whothehellcareswhatisthis/login/ssh2.php
on line 4 Authentication Failed...
但是当我输入正确的信息时,它并没有给出任何错误。
【问题讨论】:
-
你在哪个操作系统上运行这个?