RE: [PHP] Directory Listing Problem

From: Date: Tue, 03 Oct 2000 22:57:13 +0000
Subject: RE: [PHP] Directory Listing Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18486@lists.php.net to get a copy of this message
HI all again, Here is some code that works: <?php function GetDir ($sPath) { printf("<BR>Path = %s<BR>", $sPath); $list = "ls -l ".$sPath; exec($list, $array); for ($i = 0; $i < count($array); $i++) { printf($array[$i]."<BR>"); } } if (!isset($dir)) { $dir="/tmp"; } GetDir ($dir); print "<br>Current Working Directory: " . $SCRIPT_FILENAME; ?> This is the output: ***************************************** Path = /usr/local/apache/htdocs total 34 -rw-r--r-- 1 nouser nogroup 2326 Jul 3 1996 apache_pb.gif drwxr-xr-x 4 nouser nogroup 1024 Sep 8 14:19 cfs -rw-r--r-- 1 nouser nogroup 47 Oct 2 11:36 index.php -rw-r--r-- 1 root sys 17 Oct 3 18:32 info.php drwxr-xr-x 5 nouser nogroup 1536 Oct 3 18:21 intranet drwxr-xr-x 7 nouser nogroup 1024 Jun 14 14:51 manual drwxr-xr-x 2 nouser nogroup 1536 Sep 22 15:47 public -rw-r--r-- 1 root sys 407 Oct 4 08:48 readdir.php drwxr-xr-x 7 nouser nogroup 3072 Sep 21 14:52 revsnew drwxr-xr-x 2 root sys 512 Oct 3 15:18 test drwxr-xr-x 2 nouser nogroup 512 Sep 8 12:00 times Current Working Directory: /usr/local/apache/htdocs/readdir.php ******************************************* I haven't used the PHP directory functions. Just executed the ls -l command. Now.. is this proving that something in my PHP4 install using the directory commands is broken? Sam

« previous php.general (#18486) next »