简体   繁体   English

PHP ftp_login()不接受用户名和密码

[英]PHP ftp_login() not accepting username and password

We're migrating from PHP 4 to 5 (FINALLY!) 我们正在从PHP 4迁移到5(最后!)

I need a php script to connect to an external server over SSL-FTP. 我需要一个PHP脚本通过SSL-FTP连接到外部服务器。 Long story short, this works on PHP 4, but not 5. 长话短说,这适用于PHP 4,但不适用于PHP 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. 在5上返回: 警告:ftp_login()[function.ftp-login]:请使用USER和PASS登录。 in /var/www/html/test.php on line 6 failed to connect 第6行的/var/www/html/test.php中的连接失败

I'm guessing it's because I'm doing something dumb in my PHP.ini, but I can't find anything. 我猜这是因为我在PHP.ini中做了一些愚蠢的事情,但找不到任何东西。

More info: 更多信息:

OS: Redhat ES 5 2.6.18 操作系统:Redhat ES 5 2.6.18

PHP 5.2.14 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' 编译为:'./configure''--with-apxs2 = / usr / sbin / apxs''--prefix = / usr / local''--with-config-file-path = / etc''-启用-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? FTP-SSL应该在端口990上(尽管您可以在21上运行),您知道FTP服务器正在侦听哪些服务吗? 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. 在过去的好日子里,如果SSL不可用,此命令通常会回退到非SSL FTP连接,在较新的版本中,它实际上会死掉(尽管您没有收到死掉消息)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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