tags:

views:

42

answers:

1

We're migrating from PHP 4 to 5 (FINALLY!)

I need a php script to connect to an external server over SSL-FTP. Long story short, this works on PHP 4, but not 5.

<?
$user = "USER";
$pass = "PASS";

$conn_id = ftp_ssl_connect("WEBADDRESS.com",21) or die ("could not connect");
$login_result = ftp_login($conn_id,$user,$pass);
?>

On 5 it returns: Warning: ftp_login() [function.ftp-login]: Please login with USER and PASS. in /var/www/html/test.php on line 6 failed to connect

I'm guessing it's because I'm doing something dumb in my PHP.ini, but I can't find anything.

More info:

OS: Redhat ES 5 2.6.18

PHP 5.2.14

Compiled with: './configure' '--with-apxs2=/usr/sbin/apxs' '--prefix=/usr/local' '--with-config-file-path=/etc' '--enable-ftp' '--with-gd' '--with-openssl' '--with-libxml-dir' '--enable-soap' '--with-zlib' '--with-mssql=/usr/local/freetds' '--with-mysql'

A: 

FTP-SSL should be on port 990 (although you can run it on 21) do you know which service your FTP server is listening on? In the good old days this command used to fallback to non SSL FTP connections if SSL wasn't available, in the newer versions it'll actually die (although you're not getting the die message.

Rudu
The service is running on port 21. I've checked, and I can log in without SSL, so I believe you are correct about it silently falling back. This would seem to confirm it: http://bugs.php.net/bug.php?id=37799
Cubical_Man