user1120540
user1120540

Reputation: 131

Banner Timeout Error on SSH Connection in PHP

I recently downloaded the phpseclib0.3.1 library for PHP which should allow me to connect to my EC2 instances via SSH. However, I'm getting trapped with a "Banner Timeout" error message. When I call:

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

With the first argument being the Public DNS and the second argument being the port associated with the security group (the two correctly match). When this command runs I see the following error message:

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

Which corresponds to:

    // 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);

The SSH2.php file can be found from http://phpseclib.sourceforge.net/. If I'm not able to resolve this issue, what are some alternatives in PHP to connect to an EC2 instance?

Thanks!

Upvotes: 0

Views: 1921

Answers (1)

user1469439
user1469439

Reputation:

What happens if you remove the @ before the stream_select? Do any errors start showing up?

Specifically, I'm wondering if you're getting an error like this:

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

Upvotes: 3

Related Questions