ID: 42492 Updated by: [EMAIL PROTECTED] Reported By: php at stock-consulting dot com -Status: Open +Status: Feedback Bug Type: FTP related Operating System: Windows 2000 PHP Version: 5.2.4 New Comment:
And you're really using PHP 5.2.4? Previous Comments: ------------------------------------------------------------------------ [2007-08-31 11:15:27] php at stock-consulting dot com Description: ------------ Situation: the local machine, which executes the PHP script via the command line, sits behind a NAT firefall and needs to retrieve directory listings and files from an FTP server sitting somewhere on the Internet. Passive FTP is required to traverse the firewall. The local machine has the IP address 10.0.0.1 (subnet configured as Class C). The external (WAN) IP of the router/firewall is 80.x.x.x (address partially concealed to protect the, erm, innocent). Now the problem: the script correctly connects to the FTP server and begins to retrieve directory listings (recursively) and files. At some RANDOM point, the following warning appears: Warning: ftp_chdir(): PORT command only accepts client IP address (80.x.x.x !=10.0.0.1). in my_script.php on line 40 This warning then appears both at all further attempts to retrieve directory listings and files. The transfers are not successful. Note that directory and file retrieval works perfectly UNTIL the warning occurs for the first time, at some random time. When the script is restarted, it will again work for some listings and files, until, at some different point, the warning will appear again. Reproduce code: --------------- // Short version, stripped from anything which appeared not so useful for this bug report function remote_scan($path) { global $ftp; ftp_chdir($ftp, $path); $raw_entries = ftp_rawlist($ftp, $path); foreach ($raw_entries AS $line) { $entry = preg_split('@\s+@', $line, 9); if ($entry[4] == 0) { remote_scan($path . $entry[8] . '/'); } else { ftp_get($ftp, 'x:/local_path' . $path . $entry[8], $path . $entry[8], FTP_BINARY); } } } $ftp = ftp_connect('ftp.url', 47624); // server uses non-standard port $login_result = ftp_login($ftp, 'user', 'password'); ftp_pasv($ftp, true); remote_scan('/'); ftp_close($ftp); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42492&edit=1