scott.stephan Posted June 9, 2009 Share Posted June 9, 2009 Here's the rub: On one of our hosted sites, anything FTP'ed via PHP FTP functions will not work. I wrote a small program to test this: <?php // set up basic connection $ftp_server="ftp.ftp.ftp"; $conn_id = ftp_connect($ftp_server); $ftp_user_name="ftp"; $ftp_user_pass="ftp"; $destination_file="/ftp/web/content/ftptest/testfromftpserver.txt"; $source_file="test.txt"; // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_server, for user $ftp_user_name"; } // upload the file $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo "FTP upload has failed!"; } else { echo "Uploaded $source_file to $ftp_server as $destination_file"; } // close the FTP stream ftp_close($conn_id); ?> Names changed to protect the innocent . Anyhow, I had 3 servers I was testing with. We'll call them A, B and Problem. A->B is fine. B->A is fine. Problem->A or Problem->B, I get "Connected to ftp.ftp.ftp, for user ftp FTP upload has failed!". It also takes about 45 seconds to return the error, whereas in A->B or vice versa it takes about 5 seconds to get a success result. I'm guessing this could be a server configuration error, or a php.ini thing, but I'm stumped. Thoughts? Link to comment https://forums.phpfreaks.com/topic/161577-php-ftp-functionality-not-working-on-just-one-server/ Share on other sites More sharing options...
ldougherty Posted June 9, 2009 Share Posted June 9, 2009 Have you tried to make sure you have connectivity between the problem server and the other servers? IE telnet serverA 21 from SSH to see if you can gain access? Link to comment https://forums.phpfreaks.com/topic/161577-php-ftp-functionality-not-working-on-just-one-server/#findComment-852646 Share on other sites More sharing options...
scott.stephan Posted June 9, 2009 Author Share Posted June 9, 2009 It has been quite awhile since I was around SSH. Anyway, I managed to open a session, pop into TelNet and it seemed like any attempt to OPEN or PING another server ended either with an outright refusal (Unable, Connection refused) or dead air. Thoughts? Link to comment https://forums.phpfreaks.com/topic/161577-php-ftp-functionality-not-working-on-just-one-server/#findComment-852664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.