PHP execution in .html files

I have a domain that marketing says they just have to have php running on pages with the .html extension. I am moving the site to virtualmin and cann’t get it to work with mod_fcgid. On the current server I just added these lines to my .htaccess file and things worked perfectly.
RemoveHandler .html .htm
AddType application/x-httpd-php .html .htm

Can anyone help me with this issue?

Thanks
Wayne

.htaccess files are quite limited, by default, as there are potential security issues opened up by broader override options. You can set AllowOverride to permit FileInfo and Options (or just “all”, since those are the potentially dangerous ones anyway…might as well go whole hog), and restart Apache, and it’ll respect those directives.

Or, probably safer, something like this in the httpd.conf should also do the trick:

AddHandler fcgid-script .html
AddHandler fcgid-script .htm
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .html
FCGIWrapper /home/domain/fcgi-bin/php5.fcgi .htm

Find the bit where the existing fcgid-script rules are and add them there…and, obviously, replace the "domain" bit with the actual directory where this virtual server lives.

Oh, yeah, you’ll probably also need the RemoveHandler .html .htm bit before those directives, if you do opt to add to the httpd.conf file.

Ive read you can do this easily with an .htaccess file with the following line in it:
AddType application/x-httpd-php .html

That should work

I tried AllowOveride and AddType application/x-httpd-php .html.
I also tried putting the AddHandler stuff in my .htaccess. Neither one worked for me so I changed it in httpd.conf and it works.

Thanks Joe.

I met same problem.

Your answer are all right.

Thank you for your answer.

What’s with all the grave-digging today? Replying like that to a 5 years old thread is not really useful. :wink: