Cannot get phpseclib to connect - error 10060
Asked Answered
C

2

1

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

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...

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

And this is the response i am getting:

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

Cumulostratus answered 14/1, 2013 at 20:50 Comment(0)
S
0

Most likely server requires keyboard-interactive auth, while component tries password auth.

Singh answered 15/1, 2013 at 10:46 Comment(1)
The 'ss' is being output after the error - not before. Since the 'ss' is being echo'd before the login that means the error can't be with the login. Plus, phpseclib will try keyboard-interactive if password authentication fails.Yanirayank
Y
0

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.

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

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

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.

Yanirayank answered 15/1, 2013 at 17:47 Comment(2)
Firstly apologies for the delay. The error i get is not the same... Warning: fsockopen(): unable to connect to xx.xx.xx.xx:xx (No connection could be made because the target machine actively refused it. ) in D:\Files\mid_branch\www_private\application\tinyMvc.php on line 21 Warning: fgets() expects parameter 1 to be resource, boolean given in D:\Files\mid_branch\www_private\application\tinyMvc.php on line 22Cumulostratus
Yah - it sounds like it's a PHP problem. That said I'm wondering if this link doesn't apply to you: wordpress.org/support/topic/…Yanirayank

© 2022 - 2024 — McMap. All rights reserved.