我有一个通过FTP上传文件的脚本,但它在ftp_put上停止。
这是该脚本的摘要:
$conn_id = ftp_connect($ftp_server);
if (ftp_login($conn_id, $ftp_user, £ftp_pass))
$client->putLog("Login done");
ftp_pasv($conn_id, true);
if (ftp_put($conn_id, $fileName, "../tmp/" . $userId . "/" . $fileName, FTP_BINARY))
$client->putLog("File uploaded through ftp");
else
$client->putLog("Upload: " . print_r(error_get_last(), true));
ftp_close($conn_id);
$ client-> putLog是一个在日志文件中写入字符串数据的函数。 日志文件中写的是:
Login done
Upload: Array
(
[type] => 2
[message] => ftp_put() [<a href='function.ftp-put'>function.ftp-put</a>]: Type set to I
[file] => C:\Program Files (x86)\Zend\Apache2\htdocs\test\script\upload.php
[line] => 124
)
在ftp服务器上有Filezilla Server,它似乎接收了一些命令:
(000364)13/10/2015 17:01:12 - (not logged in) (ip)> Connected, sending welcome message...
(000364)13/10/2015 17:01:12 - (not logged in) (ip)> 220-FileZilla Server version 0.9.41 beta
(000364)13/10/2015 17:01:12 - (not logged in) (ip)> 220-written by Tim Kosse (Tim.Kosse@gmx.de)
(000364)13/10/2015 17:01:12 - (not logged in) (ip)> 220 Please visit http://sourceforge.net/projects/filezilla/
(000364)13/10/2015 17:01:12 - (not logged in) (ip)> USER ftpuser
(000364)13/10/2015 17:01:12 - (not logged in) (ip)> 331 Password required for ftpuser
(000364)13/10/2015 17:01:12 - (not logged in) (ip)> PASS ************
(000364)13/10/2015 17:01:12 - ftpuser (ip)> 230 Logged on
(000364)13/10/2015 17:01:12 - ftpuser (ip)> PASV
(000364)13/10/2015 17:01:12 - ftpuser (ip)> 227 Entering Passive Mode (95,110,184,28,170,145)
(000364)13/10/2015 17:01:12 - ftpuser (ip)> TYPE I
(000364)13/10/2015 17:01:12 - ftpuser (ip)> 200 Type set to I
(000364)13/10/2015 17:02:45 - ftpuser (ip)> QUIT
(000364)13/10/2015 17:02:45 - ftpuser (ip)> 221 Goodbye
(000364)13/10/2015 17:02:45 - ftpuser (ip)> disconnected.
我甚至开始使用wireshark会话,我收到的所有内容(使用ftp过滤器)都是:
Request command: USER
Request command: PASS
Request command: PASV
Request command: TYPE I
Request command: QUIT
建议为什么这不起作用?
顺便说一下,在另一台服务器上它运行得很完美......