Jump to content

PHP Directory Listing Not working


ev5unleash

Recommended Posts

Hey Guys,

 

I need help, I tried a ton of directory listing scripts and they all don't work. Althogh the normal Apache Directory Indexing does work when you visit. The URL is http://ev5unleash.dnsalias.org. The PHP directory listing is http://ev5unleash.dnsalias.org/test.php

 

I'm currently running Wamp 2.0 (Apache/PHP/MySQL).

 

Need a fix asap.

 

Link to comment
https://forums.phpfreaks.com/topic/189738-php-directory-listing-not-working/
Share on other sites

You have your php code showing in the output - it is not being run

 

a) Are you sure you have php enabled?

b) as you are using short tags, are you sure you have php short tags enabled?

 

to test for the latter, change <? to <?php and <?=  to <?php echo

Thanks for the quick response.

 

1. I know the PHP is running because I get PHP error scripts when I do something wrong.

 

I tried scripts like this:

<?

//define the path as relative
$path = "/home/yoursite/public_html/whatever";

//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo "Directory Listing of $path<br/>";

//running the while loop
while ($file = readdir($dir_handle)) 
{
   echo "<a href='$file'>$file</a><br/>";
}

//closing the directory
closedir($dir_handle);

?>

 

But it doesn't respond with anything on the page. Just blank.

 

Thanks for the quick response.

 

1. I know the PHP is running because I get PHP error scripts when I do something wrong.

 

I tried scripts like this:

<?

//define the path as relative
$path = "/home/yoursite/public_html/whatever";

//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo "Directory Listing of $path<br/>";

//running the while loop
while ($file = readdir($dir_handle)) 
{
   echo "<a href='$file'>$file</a><br/>";
}

//closing the directory
closedir($dir_handle);

?>

 

But it doesn't respond with anything on the page. Just blank.

 

Did you make sure to turn on short open tags?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.