I'm using phpseclib to connect to a sftp server using the NET/sftp.php NET_SFTP class included in the library as such:
/* sftp connection */
$this->log[] = '<b>Connecting to:</b> <i>'.$this->ftpServer.'</i><br/>';
// Set up a connection
$sftp = new Net_SFTP($this->ftpServer, $this->ftpPort);
if (!$sftp->login($this->ftpUsername, $this->ftpPassword)) {
exit('Login Failed');
}
echo $sftp->pwd() . "\r\n";
$sftp->put('filename.ext', 'hello, world!');
print_r($sftp->nlist());
I have chceked that the ftpServer and ftpPort variables are correct and my output is:
Notice: Cannot connect to nasl2-itpartner.ddns.me:2223. Error 111. Connection refused in /home/itpabse/public_html/administrator/components/com_itpartner_backup/assets/php/sftp/Net/SSH2.php on line 1049
Login Failed
The problem is I cant find documentation for error 111 anywhere. I have tried connecting to the server with filezilla using sftp ssh no problem. Any thoughts on what may be going wrong here?
Logfile from filezilla connecting to the server from the same machine running the script: https://drive.google.com/file/d/0B5BDN-5z0pdmeWM2T093S3dIS2s/view?usp=sharing