PHP中SSH连接的横幅超时错误

时间:2013-01-09 03:43:27

标签: php ssh amazon-ec2 remote-access phpseclib

我最近下载了PHP的phpseclib0.3.1库,它允许我通过SSH连接到我的EC2实例。但是,我遇到了“横幅超时”错误消息。我打电话的时候:

$ssh = new Net_SSH2('ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com',1234);

第一个参数是公共DNS,第二个参数是与安全组关联的端口(两个正确匹配)。运行此命令时,我看到以下错误消息:

Notice: Cannot connect to ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com. Banner timeout in ...\SSH2.php on line 815

对应于:

    // on windows this returns a "Warning: Invalid CRT parameters detected" error
    // the !count() is done as a workaround for <https://bugs.php.net/42682>
    if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) {


        user_error(rtrim("Cannot connect to $host. Banner timeout"), E_USER_NOTICE);

可以从http://phpseclib.sourceforge.net/找到SSH2.php文件。如果我无法解决此问题,PHP中有哪些替代方案可以连接到EC2实例?

谢谢!

1 个答案:

答案 0 :(得分:3)

如果在stream_select之前删除@,会发生什么?是否有任何错误开始出现?

具体来说,我想知道你是否收到这样的错误:

http://www.frostjedi.com/phpbb3/viewtopic.php?p=384914#p384914