Most of the times we use ssh2_connect() function to connect and download files from remote server without using ftp. Sometimes it doesn't work. Please note some useful tips: 1) Make ensure that openssl is enabled and libssh2 is installed on your server. 2) Even after that when calling ssh2_connect() function if you are getting errors like following: [Sat Dec 03 19:30:35 2011] [error] [client 172.16.xxx.xx] PHP Warning: ssh2_connect(): Unable to connect to 172.18.xx.xxx on port 22 in /var/www/html/connection.php on line 9 [Sat Dec 03 19:30:35 2011] [error] [client 172.16.xxx.xx] PHP Warning: ssh2_connect(): Unable to connect to 172.18.xx.xxx in /var/www/html/connection.php on line 9 It means apache is not allowed to send packets using tcp. Then run the following command from your server console: //Allow HTTPD scripts and modules to connect to the network using any TCP port. # setsebool -P httpd_can_network_connect 1 here P stands for permanent. Sometimes th