How to get PHP to execute when using it as the header/readme for mod_autoindex

445 Views Asked by At

Apache mod_autoindex allows you not only to have directories automatically generated, but to customize them to many degrees, including custom header and readme (footer) files. However, when using PHP for those files, the PHP fails to execute. The resulting page has PHP code throughout it, rather than the dynamic content said code should have produce.

Something as simple as writing out the name of the directory fails, because PHP will not execute.

I have searched, and found that adding the following to your .htaccess should fix this:

AddType text/html .php 
AddHandler application/x-httpd-php .php 

However, it seems to make no difference.

1

There are 1 best solutions below

0
On

Without further information this would be very hard to debug... I would suggest going through all of the steps in this answer and if that does not yield any results, post more details about your current setup.