无法连接 phpseclib - 错误 10060 [英] Cannot get phpseclib to connect - error 10060

查看:58
本文介绍了无法连接 phpseclib - 错误 10060的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让运行 easyPHP 12 的本地环境 Win7 连接到我的服务器 ubuntu 11.04.

I cannot get my local environment, Win7 running easyPHP 12, to connect to my server, ubuntu 11.04.

我通过 sftp 连接到我的服务器,filezilla 很好,我可以通过 ssh 连接到我的服务器,putty 很好...服务器目前不需要密钥,只需要一个 uname 和 pword...

I connect to my server via sftp with filezilla fine, i can connect to my server via ssh with putty fine... the server requires no keys at the moment just a uname and pword...

我不明白,我通过 php 脚本传递的细节与我从 filezilla 和 putty 传递的细节完全相同.

I don't get it, the details i am passing via the php script are exactly the same as the ones i pass from filezilla and putty.

这是剥离到基本的代码:

This is the code stripped to the bare basic:

//inlcude the phpseclib path in the include array and include the ssh2 class
set_include_path( WEBROOT_PRIVATE.'scripts/phpseclib0.3.0' );
if(!include('Net/SSH2.php')){
    echo 'Sorry failed to load SSH2 class';
    br();
}
if(!include('Net/SFTP.php')){
    echo 'Sorry failed to load SFTP class';
    br();
}
$connection = new Net_SFTP( 'xx.xx.xx.xx', 'xx' );
echo 'ss';
$login = $connection->login( 'username', 'password');
exit();

这是我得到的回应:

注意:无法连接到 xx.xx.xx.xx.错误 10060.一个连接尝试失败,因为连接方没有正确响应一段时间后,或建立连接失败,因为连接的主机未能响应.在....\www_private\scripts\phpseclib0.3.0\Net\SSH2.php在线 776 ss

Notice: Cannot connect to xx.xx.xx.xx. Error 10060. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in ....\www_private\scripts\phpseclib0.3.0\Net\SSH2.php on line 776 ss

推荐答案

fsockopen 失败并出现错误,这表明这不是 phpseclib 问题,而是 PHP 问题.

It's failing with fsockopen with the error that you're getting, which suggests to me it's not a phpseclib problem so much as a PHP one.

所以 SSH 的工作方式是,当您尝试连接时,服务器会立即向您发送横幅.例如,它为 stackoverflow.com 执行此操作:

So the way SSH works is that the server sends a banner immediately to you when you try to connect. It does that for stackoverflow.com for example:

<?php
$fsock = fsockopen('www.stackoverflow.com', 22);
echo fgets($fsock, 1024);

当我运行该脚本时,我会返回SSH-2.0-OpenSSH_5.3".

When I run that script I get "SSH-2.0-OpenSSH_5.3" back.

我的猜测是,如果您更新该 PHP 脚本以与您的服务器一起使用,您将收到 phpseclib 给您的相同错误消息.

My guess would be that if you update that PHP script to work with your server you'll get the same error message phpseclib is giving you.

这篇关于无法连接 phpseclib - 错误 10060的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆