php ssh2连接到本地主机

php ssh2连接到本地主机,php,ssh,Php,Ssh,我会尝试使用ssh2在本地主机上读取我的ubuntu系统,如果可以正常工作,我会尝试通过网络连接读取。但在第一步,我在本地主机上连接自己时遇到了问题 $connection = ssh2_connect('localhost', 22); 结果 Warning: ssh2_connect(): Unable to connect to localhost on port 22 in /var/www/system/index.php on line 6 Warning: ssh2_con

我会尝试使用ssh2在本地主机上读取我的ubuntu系统,如果可以正常工作,我会尝试通过网络连接读取。但在第一步,我在本地主机上连接自己时遇到了问题

$connection = ssh2_connect('localhost', 22);
结果

 Warning: ssh2_connect(): Unable to connect to localhost on port 22 in /var/www/system/index.php on line 6

 Warning: ssh2_connect(): Unable to connect to localhost in /var/www/system/index.php on line 6

米阿比,我还需要做点别的吗

向我们展示您的PHP代码。您确定在本地系统上运行SSH服务器吗?如果从shell执行ssh localhost,会发生什么情况?@JustinWood您还需要查看哪些其他代码?该行不依赖于任何其他内容。从shell ssh:connect to host localhost端口22:Connection Returned ssh\u exchange\u identification:Connection closed by remote host