简体   繁体   中英

PHP ftp_login() not accepting username and password

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'

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM