|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16057 ftp_nlist() and ftp_rawlist() return nothing
Submitted: 2002-03-14 02:23 UTC Modified: 2004-09-06 14:57 UTC
Avg. Score:4.6 ± 0.7
Reproduced:18 of 18 (100.0%)
Same Version:14 (77.8%)
Same OS:16 (88.9%)
From: ryan at wonko dot com Assigned:
Status: Not a bug Package: FTP related
PHP Version: 4.1.2 OS: Windows 2000 Advanced Server
Private report: No CVE-ID:
 [2002-03-14 02:23 UTC] ryan at wonko dot com
In the Windows build of PHP 4.1.1, the ftp_nlist() and ftp_rawlist() functions return absolutely nothing. The following script works just fine in PHP 4.1.1 on Linux, but fails under Windows, no matter what FTP server you try to connect to:

$conn = ftp_connect("");
ftp_login($conn, "anonymous", "");
$nlist = ftp_nlist($conn, "");
$rawlist = ftp_rawlist($conn, "");

echo "<pre>";
echo "</pre>";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-02 13:39 UTC]
Dupe of 13913
 [2002-08-16 10:03 UTC]
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at

This issue appears to be fixed in the latest CVS. You can grab a snapshot of it here:
 [2003-12-12 16:19 UTC] pdavis at pobox dot com
PHP 4.3.3 seems to be showing the same problem. When trying to connect to my own FTP server (Windows/IIS) and checking the FTP log file, it seems that the login and CWD are successful but no directory request ever comes through.

I moved the code over to a Linux server and connected to the IIS FTP server that I was originally trying to connect to and everything worked fine.
 [2003-12-16 04:55 UTC] mnares at cox dot net
This issue is still not fixed...I am running PHP 4.3.3 on Windows XP SP 1, and I still get this error.
 [2003-12-23 14:35 UTC] mfeldNOSPAMPLEASE at mftronic dot de
I'm using PHP 4.3.2 on WinXP SP1, and when using the ftp_Xlist() functions, it sometimes works and sometimes not (returns bool(false)) - almost randomly.
Inserting a "var_dump()" has sometimes increased my chances that such a call works, like

$dirlist = ftp_rawlist($conn_id, "");
 [2004-01-10 13:19 UTC] bug at nexus-zone dot com
same problem apears on version 4.3.4
will it ever work?
 [2004-01-13 09:03 UTC] sean at abcvoice dot com
Hate to be a "Me Too" poster, but:
OS: Windows XP (SP1)
PHP: 4.3.2

When connecting to an FTP and getting a rawlist, if I'm getting the root directory and it contains a colon (:) then rawlist (and nlist) return nothing. If I'm getting a rawlist of something in a subdirectory of root (even if root contains a colon) then it works every time.
 [2004-01-14 09:26 UTC] orlax at gmx dot net
It's fixed in ver. 5. Works fine with windows + iss + ftp.
 [2004-01-21 13:50 UTC] bo at sgmbiotech dot com
This issue is not fixed in 4.3.4 on IIS5, connecting to remote microsoft FTP server. 

Interesting note: these functions work fine if logged into a domain with administrator rights.  When logged in as a regular user the functions return false.  However, ftp_put and ftp_get  all work fine....the problem is only when listing directories.  I fail to see how user rights external to IIS should have any impact these particular functions, but somehow they do.
 [2004-02-06 01:32 UTC] phpbugs at psychicsms dot com dot au
Same here. When I run as Administrator I can execute ftp_rawlist(). When I run as a user, I cannot.
 [2004-02-12 16:57 UTC]
As already stated in other duplicates of this bug report.  ftp_(n)list requires write permissions to the system's tempoarary directory.  IIS's default installation does not include this in the permissions for IUSR.  The bug is in system configuration, not PHP.

 [2004-09-06 14:54 UTC] henkoooo at hotmail dot com
Me too!
FTP:ServU build
OS:Windows 2000 Server
 [2004-09-06 14:57 UTC]
Re-read last comment by pollita.

Not a PHP bug (additionaly, it's a duplicate) -> bogus.

 [2004-09-27 00:04 UTC] Tommy at kak-networks dot net
Why dont the devels just fix this prob in 4.x?
 [2004-09-28 20:42 UTC] pcatlin at plus dot com
Took a while but have now figured out a work around for this VERY annoying little problem.

PHP or IIS tries to write a temporary file, but NOT in the c:\windows\temp folder.  It writes this file in the C:\ root.  With permissions set to allow which ever user PHP is running as access to write this file, ftp_nlist will work.

It tries to write a file called c:\t3lo

Hope this is useful to other people stuck on this. :)
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 22:01:31 2015 UTC