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
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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.