Jim:
Thanks.
Maybe that's my mistake that use pasv,and I used "ls" in FTP command line,it worked well certainly,but it can't work in socket in php,I have work in interactive so I must in this session.that 's my problem,and the order of command is simulate to the order of CuteFtp,that is cuteFTP 's work log:
STATUS:> Connecting to wg
STATUS:> Connecting to wg (ip = 127.0.0.1)
STATUS:> Socket connected. Waiting for welcome message...
220 wg Microsoft FTP Service (Version 5.0).
STATUS:> Connected. Authenticating...
COMMAND:> USER anonymous
331 Anonymous access allowed, send identity (e-mail name) as password.
COMMAND:> PASS ********
230-Hello,This is Wg's FTP Server
230 Anonymous user logged in.
STATUS:> Login successful
COMMAND:> TYPE I
200 Type set to I.
COMMAND:> REST 100
350 Restarting at 100.
STATUS:> This site can resume broken downloads
COMMAND:> REST 0
350 Restarting at 0.
COMMAND:> pwd
257 "/" is current directory.
COMMAND:> TYPE A
200 Type set to A.
STATUS:> Retrieving directory listing...
COMMAND:> PORT 127,0,0,1,12,67
200 PORT command successful.
COMMAND:> LIST
150 Opening ASCII mode data connection for /bin/ls.
226 Transfer complete.
STATUS:> Received 201 bytes Ok.
STATUS:> Time: 0:00:01, Efficiency: 0.20 KBytes/s (201 bytes/s)
STATUS:> Done.
It's command order is :USER anonymous ¡¢PASS ********¡¢TYPE I¡¢REST 100¡¢REST 0¡¢ pwd¡¢TYPE A¡¢PORT 127,0,0,1,12,67¡¢£¨LIST£¡£¡£¡£©£¬My command is the same to it and the result is right except "LIST",WHY? Dont't The cuteFtp work under interactive session?Which is my error code?
Jim wrote:
Why are you entering pasv mode? I thought this was only useful for sending data streams back and forth between two remote server!! And if I am right, I don't see any need in using passive mode. Try taking it out and then ls'ing(not LIST'ing).
when I tried to run your commands from ftp non-interactive session I got the following:
ftp> quote pasv
227 Entering Passive Mode (xxx,xxx,xxx,xxx,xxx,120)
ftp> quote list
Connection closed by remote host.
ftp>
AND if I didn't go into pasv mode but tried to run the LIST command I got:
ftp> quote LIST
425 Can't build data connection: Connection refused.
ftp>
Now, if I simply did this connection the way I would in any regular ftp session things worked fine:
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for 'file list'.
.cshrc
.login
.login_conf
...
So, I would take the pasv out of there. And I would only use QUOTE when absolutely needed.