ID: 20526 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Feedback +Status: Open Bug Type: FTP related Operating System: MS Windows XP Pro PHP Version: 4.3.0RC1 New Comment:
Tried http://snaps.php.net/win32/php4-win32-latest.zip with same result. One of my reasons to suspect it is a bug is that the problem reported by PHP (FTP server reports 227), in my opinion, should not indicate an error at all. I am now trying to arrange a debug session by myself (I just downloaded Cygwin, PHP sources and other stuff suggested in the PHP manual, but this is for me quite a challenge, since I got somewhat rusted with software development :-) Wish me good luck... Ciao. Giovanni Previous Comments: ------------------------------------------------------------------------ [2002-11-24 12:53:43] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip Cannot replicate the problem on WinXP or Linux with a variety of FTP servers. ------------------------------------------------------------------------ [2002-11-20 18:01:06] [EMAIL PROTECTED] fopen with ftp URL returns false despite ftp server executes get Tested in loopback with IP 127.0.0.1 and BulletProof ftp server running on the same machine. Note, in the server log pasted here below, that the ftp client seems to be quitting the connection before the transfer is complete. Used PHP version: php-4.3.0RC1-Win32.zip OS.: Microsoft Windows XP Professional 2002 php.ini was a copy of php.ini-recommended with only following modif.: extension_dir = C:\PHP cgi.force_redirect = 0 ============ My PHP program ====================== <?php $FTPStr = ftp_connect('127.0.0.1'); ftp_login($FTPStr,'anonymous',''); $FileNames = ftp_nlist($FTPStr,'pub/*.txt'); ftp_quit($FTPStr); foreach ($FileNames as $Current) { printf("%s\n",$Current); } if (!($File = fopen ('ftp://anonymous:@127.0.0.1/pub/short.txt','r'))) { printf("Cant't open file\n"); return; } $Count = 1; while (!feof ($File)) { $line = fgets ($File, 1024); printf("%d %s\n",$Count,$line); $Count += 1; } fclose($File); ?> ============ Running the program C:\PHP>php -f c:\inetpub\wwwroot\ftp_ls_and_wrap_fopen.php PHP Warning: fopen() [http://www.php.net/function.fopen]: php_hostconnect: conn ect failed in c:\inetpub\wwwroot\ftp_ls_and_wrap_fopen.php on line 11 PHP Warning: fopen(ftp:[EMAIL PROTECTED]/pub/short.txt) [http://www.php.net/funct ion.fopen]: failed to create stream: FTP server reports 227 Entering Passive Mod e (127.0.0.1 in c:\inetpub\wwwroot\ftp_ls_and_wrap_fopen.php on line 11 dummy1.txt dummy2.txt short.txt Cant't open file ================ (Pasted) log from BulletProof FTP Server v2.15 ======================== 21/11/2002 00:33:59 - FTP Server On-line : IP(s) 192.168.1.34, on port 21 (000001) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > connected to ip : 127.0.0.1 (000001) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > sending welcome message. (000001) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > 220 BulletProof FTP Server ready ... (000001) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > USER anonymous (000001) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > 331 Password required for anonymous. (000001) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > PASS ******** (000001) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > logged in. (000001) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 230 User anonymous logged in. (000001) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > PORT 127,0,0,1,10,77 (000001) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 200 Port command successful. (000001) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > NLST pub/*.txt (000001) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 150 Opening data connection for directory list. (000001) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 226 Transfer ok (000001) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > disconnected. (00:00:00) (000002) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > connected to ip : 127.0.0.1 (000002) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > sending welcome message. (000002) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > 220 BulletProof FTP Server ready ... (000002) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > USER anonymous (000002) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > 331 Password required for anonymous. (000002) 21/11/2002 00:34:07 - (not logged in) (127.0.0.1) > PASS ******** (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > logged in. (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 230 User anonymous logged in. (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > TYPE I (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 200 Type set to I. (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > SIZE /pub/short.txt (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 213 24 (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > EPSV (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 500 Unknown command. (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > PASV (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 227 Entering Passive Mode (127,0,0,1,82,146). (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > RETR /pub/short.txt (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > asked to download 'E:\FTPdir\pub\short.txt' --> Access allowed. (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > QUIT (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 221 Bye bye ... (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > finished downloading 'E:\FTPdir\pub\short.txt' - (00:34:08 - 0.000 KB - 0.000 KBytes/s) (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > 226 Transfer ok (000002) 21/11/2002 00:34:07 - anonymous (127.0.0.1) > disconnected. (00:00:00) ==================== with the basic ftp client of Windows, "get" works and file is not empty... C:\PHP>ftp 127.0.0.1 Connected to 127.0.0.1. 220 BulletProof FTP Server ready ... User (127.0.0.1:(none)): anonymous 331 Password required for anonymous. Password: 230 User anonymous logged in. ftp> ls /pub/*.txt 200 Port command successful. 150 Opening data connection for directory list. dummy1.txt dummy2.txt short.txt 226 Transfer ok ftp: 35 bytes received in 0.00Seconds 35000.00Kbytes/sec. ftp> get /pub/short.txt 200 Port command successful. 150 Opening data connection for short.txt (24 bytes). 226 Transfer ok ftp: 24 bytes received in 0.00Seconds 24000.00Kbytes/sec. ftp> disconnect 221 Bye bye ... ftp> bye C:\PHP>type short.txt Pippo Pluto Paperino C:\PHP> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20526&edit=1