RE: [PHP] Directory Listing Problem

From: Date: Tue, 03 Oct 2000 09:23:21 +0000
Subject: RE: [PHP] Directory Listing Problem
Groups: php.general 
Request: Send a blank email to php-general+get-18390@lists.php.net to get a copy of this message
Can you try this out - if you pass it ?dir=/whatever it will print the listing - you can plug in attempts in the url line. readdir.php <?php function GetDir ($sPath) { $handle=opendir ($sPath); while ($file=readdir($handle)){ echo $file . "<br>"; } } if (!isset($dir)) { $dir="/tmp"; } GetDir ($dir); print "<br>Current Working Directory: " . $SCRIPT_FILENAME; ?> Eg readdir.php?dir=/tmp readdir.php?dir=/usr/local/apache/htdocs/intranet/tmp This should make debugging / testing a little faster for you. cheers, Lawrence. -----Original Message----- From: Lawrence.Sheed@dfait-maeci.gc.ca [mailto:Lawrence.Sheed@dfait-maeci.gc.ca] Sent: October 3, 2000 05:16 PM To: samantha@cfs.net.au; php-general@lists.php.net Subject: RE: [PHP] Directory Listing Problem You'll need to chmod 777 the directory (and under) to check from a shell: chmod -R 777 /usr/local/apache/htdocs then open from code you had. ought to do it (permissions wise). Why do you want a /tmp out of the web root though? Slightly confused by that, .htaccess would solve permissions from apache side, so you wouldn't have security issues... NB $DOCUMENT_ROOT gives the web document root - so if you wanted /usr/local/apache/htdocs/intranet/tmp for example and your $DOCUMENT_ROOT was /usr/local/apache/htdocs/intranet, then you would just add /tmp to the end of it. I would do a print of the $DOCUMENT_ROOT anyway to see what the web root is anyway, so we can then test a directory from there. eg <?php print "Document root is:".$DOCUMENT_ROOT; ?> Its a useful thing to know imho. Cheers, Lawrence. -----Original Message----- From: Samantha Savvakis [mailto:samantha@cfs.net.au] Sent: October 3, 2000 05:05 PM To: Ramender Kishore; PHP General Subject: RE: [PHP] Directory Listing Problem I know that the "apache" user can read this directory. Just logged in as the "apache" user and I can do directory listings. I created a few files just to make sure I was logged in as the right user. There is another directory I've got setup at this file path: /usr/local/apache/htdocs/intranet/quality I can go directly to this directory within my browser and it will give me a directory listing. ******************************** Index of /intranet/quality Name Last modified Size Description ---------------------------------------------------------------------------- ---- Parent Directory 03-Oct-2000 18:21 - Configuration/ 03-Oct-2000 17:45 - Installation/ 03-Oct-2000 17:45 - Testing/ 03-Oct-2000 17:46 - ---------------------------------------------------------------------------- ---- Apache/1.3.11 Ben-SSL/1.38 Server at can.bris.cfs.net.au Port 80 ********************************* I tried to read that same directory in the opendir code and it still won't give a directory listing. I changed permissions on all files to 755 to see if the execute permission on files as well as directories would make the difference. I'm trying out all suggestions here. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#18390) next »