Re: opendir trouble (accessing directories)

From: Date: Wed, 05 Sep 2001 08:03:12 +0000
Subject: Re: opendir trouble (accessing directories)
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-9194@lists.php.net to get a copy of this message
Try $dir_name = "../files"; Paul Kalyakin wrote: > i've installed Apache 1.3.20 and PHP 4.06 > i've added the following strings to the httpd.conf file > <VirtualHost 127.0.0.2> > ServerName localhost2 > ServerAdmin userguide@webservis.ru > DocumentRoot "c:/inetpub/localhost2 > <Directory "c:/inetpub/localhost2"> > Options Includes FollowSymLinks MultiViews > AllowOverride None > Order allow,deny > Allow from all > </Directory> > ScriptAlias /cgi-bin/ "c:/inetpub/localhost2/cgi-bin/" > ErrorLog "c:/inetpub/error.log" > CustomLog "c:/inetpub/custom.log" common > </VirtualHost> > > i've created folder c:\inetpub\localhost2 and added string 127.0.0.2 > localhost2 to the HOSTS file. > > everything works fine to this point. simple index.html file is shown after > the http://localhost2 request in browser URL > > i've created FILES folder in the c:\inetpub\localhost2 folder and created > test.php file in the localhost2 folder > > =========test.php============ > <? > $dir_name = "/files"; > > $dir = @opendir($dir_name) or die( "Directory \"$dir_name\"not found."); > > $file_list = "<ul>"; > > while ($file_name = readdir($dir)) { > if (($file_name != ".") && ($file_name != "..")) { > $file_list .= "<li>$file_name"; > } > } > > $file_list .= "</ul>"; > > closedir($dir); > > ?> > > <!-- Start your HTML --> > > <HTML> > <HEAD> > <TITLE>Directory Listing</TITLE> > </HEAD> > <BODY> > > <!-- Use PHP to print the name of the directory you read --> > > <P>Files in: <? echo "$dir_name"; ?></p> > > <!-- Use PHP to print the directory listing --> > <? echo "$file_list"; ?> > > </BODY> > </HTML> > > ==============/test.php============= > > but when i try to execute this file, i see "Directory "/files"not found." > What i'm doing wrong ? -- Michel Laine Engineer / Network Administrator SYSTEM TECHNOLOGY SWEDEN AB Phone:(+46)-8-982255 Fax:(+46)-8-982060 Snail mail: Vretenvagen 2, 171 54 SOLNA, SWEDEN E-mail: michel@systemtech.se WWW: http://www.systemtech.se

« previous php.windows (#9194) next »