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

时间:2010-09-15 16:06:50

标签: php ssl ftp

我们正在从PHP 4迁移到5(最终!)

我需要一个php脚本通过SSL-FTP连接到外部服务器。长话短说,这适用于PHP 4,但不适用于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);
?>

在5上它返回:警告:ftp_login()[function.ftp-login]:请使用USER和PASS登录。在第6行的/var/www/html/test.php中 无法连接

我猜这是因为我在PHP.ini中做了一些蠢事,但我找不到任何东西。

更多信息:

操作系统:Redhat ES 5 2.6.18

PHP 5.2.14

编译:'。/ 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'

1 个答案:

答案 0 :(得分:0)

FTP-SSL应该在端口990上(尽管你可以在21上运行它)你知道你的FTP服务器正在监听哪种服务吗?在过去的好时光中,如果SSL不可用,此命令将用于回退到非SSL FTP连接,在较新版本中,它实际上会死掉(尽管您没有收到死讯。