PHP built in server, any way to configure it to show files of directory?
php
Solution
As mentioned by Colin in his comment, the integrated server is intended for debugging purposes only, therefore you should expect it to not have all the features you would expect of a full server.
However, it's easy enough to build your own `index.php` to simulate the default Apache index:
<?php
$dir = substr(dirname($_SERVER['PHP_SELF']),strlen($_SERVER['DOCUMENT_ROOT']));
echo "<h2>Index of ".$dir.":</h2>";
$g = glob("*");
usort($g,function($a,$b) {
if(is_dir($a) == is_dir($b))
return strnatcasecmp($a,$b);
else
return is_dir($a) ? -1 : 1;
});
echo implode("<br>",array_map(function($a) {return '<a href="'.$a.'">'.$a.'</a>';},$g));
Problem
As yous may be aware, as of PHP 5.4 there is built in server available. However, if you browse to directory with no "index" file, instead if listing all available files/directories (like apache for example), it will give you and error. Now as far as I understand this is by design and not some sort of bug. But maybe someone knows if there is a way to configure it, to list the contents of directory?