Re: readdir
| From: | David Robley | Date: | Thu, 10 Aug 2000 02:54:56 +0000 |
| Subject: | Re: readdir | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11051@lists.php.net to get a copy of this message | ||
On 9 Aug, Chris wrote:
>
> Here is part of the ls -al on the directory. I thought perhaps the naming
> conventions with "-", and "+" may be throwing it off but I have tried on
> several directories with basic naming conventions. I have changed the
> ownership from root to nobody to normal users and even set the directory
> and files 777.
>
> I did upgrade Apache at the same time so I am wondering if an httpd.conf
> directive could cause such problems. I have picked through it and see no
> problems.
>
> rwxr-xr-x 2 webmastr users 4096 Aug 9 12:47 ./
> drwxr-xr-x 7 webmastr users 1024 Aug 9 12:59 ../
> -rw-r--r-- 1 webmastr users 74653 Nov 21 1999 3Dfx-HOWTO
> -rw-r--r-- 1 webmastr users 105257 Oct 25 1999 AI-Alife-HOWTO
> -rw-r--r-- 1 webmastr users 140723 Nov 3 1997 AX25-HOWTO
> -rw-r--r-- 1 webmastr users 64589 Mar 30 1997 Access-HOWTO
> -rw-r--r-- 1 webmastr users 22533 Sep 2 1997 Alpha-HOWTO
> -rw-r--r-- 1 webmastr users 70845 Sep 18 1999 Assembly-HOWTO
> -rw-r--r-- 1 webmastr users 60688 Nov 21 1999 Bash-Prompt-HOWTO
> -rw-r--r-- 1 webmastr users 42434 Sep 12 1999 Belgian-HOWTO
> -rw-r--r-- 1 webmastr users 43468 Nov 21 1999 Benchmarking-HOWTO
> -rw-r--r-- 1 webmastr users 50910 Nov 21 1999 Beowulf-HOWTO
> -rw-r--r-- 1 webmastr users 93578 Nov 21 1999 BootPrompt-HOWTO
> -rw-r--r-- 1 webmastr users 99919 Oct 28 1999 Bootdisk-HOWTO
> -rw-r--r-- 1 webmastr users 22902 Nov 21 1999 Busmouse-HOWTO
> -rw-r--r-- 1 webmastr users 62928 Sep 28 1999 CD-Writing-HOWTO
> -rw-r--r-- 1 webmastr users 71434 Nov 21 1999 CDROM-HOWTO
>
>
> Two scripts;
>
> <?php
> $blah = "Print Something";
> $dir = opendir('.');
> echo "$blah";
> while($file = readdir($dir)) {
> echo "$blah\n";
>
> echo "$file\n";
> }
> closedir($dir);
> ?>
>
>
> Only returns "Print Something" once
>
>
>
>
> <?php
> $handle=opendir('.');
> echo "Directory handle: $handle\n";
> echo "Files:\n";
> while (($file = readdir($handle))!==false) {
> echo "$file\n";
> }
> closedir($handle);
> ?>
>
> Returns "Directory handle: Resource id #1 Files: "
>
>
> Thanks again for your help.
>
> Chris
What happens if you specify a full path to the directory you want to
read? You can't be sure where '.' is, can you?
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA