I have virtual hosts set up so that I can access multiple websites. Each website is in a subdirectory of /opt/lampp/htdocs. Here is an example:
- Code: Select all
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/localhost"
ServerName localhost
ErrorLog "logs/localhost-error_log"
CustomLog "logs/localhost-access_log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/bwd"
ServerName localhost.bwd
ErrorLog "logs/bwd-error_log"
CustomLog "logs/bwd-access_log" common
</VirtualHost>
The point of having a virtual host for localhost is that I usually get a directory listing with PHP for /opt/lampp/htdocs. By doing this, I can create a list of links to all of the subdirectories (virtual hosts). I've been doing this for a long time on Windows, and I understand that Linux has different permissions, but even if all files and dir permissions are changed I have not had success.
The directory listing is very simple, but fails at the attempt to open:
- Code: Select all
// $handle ends up being (bool) FALSE
$handle = opendir(__DIR__ . '../');
Because virtual hosts is working, and all file and dir permissions set to 777, I'm thinking the issue is for sure with Apache, but don't know what to change to get the directory listing to work.
Please advise.