This might help others. You need to make sure TCP_OUT port is open on your remote server to make it work.
Thanks for the help!
Pergunta
I am trying to connect to a remote SFTP server using PHP. My code works fine when I connect to a local SFTP account but it times out for remote host. I have made sure through FTP client that host information is correct and its connecting fine.
I am using phpseclib library and my three line code is below.
require_once("phpseclib/Net/SFTP.php");
$sftp = new Net_SFTP('remote_host_IP');
var_dump($sftp->login('<username>', '<password>'));
It returns false (meaning not connected).
What I have done
Any valuable hint please?
Solução 2
This might help others. You need to make sure TCP_OUT port is open on your remote server to make it work.
Thanks for the help!
Outras dicas
Do define('NET_SSH2_LOGGING', 2)
before initializing Net_SFTP and then do $sftp->getLog()
after $sftp->login()
That'll provide enough info with which a diagnostic can be made.