Directory Listing Problem
| From: | Samantha Savvakis | Date: | Tue, 03 Oct 2000 08:42:46 +0000 |
| Subject: | Directory Listing Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18383@lists.php.net to get a copy of this message | ||
Hi,
I have run into a slight problem using the directory functions in PHP.
Versions:
* Apache/1.3.11 Ben-SSL/1.38 (Unix)
* PHP/4.0.3-dev
I have copied the details straight from the PHP Manual:
<?php
$handle=opendir('/tmp');
echo "Directory handle: $handle<BR>\n";
echo "Files:<BR>\n";
while (($file = readdir($handle))!==false) {
echo "$file\n";
}
closedir($handle);
?>
I get the following output:
************
Directory handle: Resource id #1
Files:
************
No files are being displayed.
Then I tried the "dir" class method.
Again, code straight from the PHP manual:
$d = dir("/tmp");
echo "Handle: ".$d->handle."<br>\n";
echo "Path: ".$d->path."<br>\n";
while($entry=$d->read()) {
echo $entry."<br>\n";
}
$d->close();
Output:
***************
Handle: :Resource id #1
Path: /tmp
***************
Again, no files listed.
I have checked permissions on the directory. The apache user definitely has
"read" access to the /tmp directory.
Is there some sort of setting in the apache conf file that I need?
Thanks,
Sam