PHP execution in .html files

8 posts / 0 new
Last post
#1 Tue, 06/10/2008 - 04:25
testdog

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

Tue, 06/10/2008 - 11:50
Joe
Joe's picture

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

--

Check out the forum guidelines!

Tue, 06/10/2008 - 11:51 (Reply to #2)
Joe
Joe's picture

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.

--

Check out the forum guidelines!

Wed, 06/11/2008 - 02:58 (Reply to #3)
testdog

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.

Thu, 10/10/2013 - 05:57 (Reply to #4)
humansoft

I met same problem.

Your answer are all right.

Thank you for your answer.

- Old man novice

Thu, 10/10/2013 - 07:00 (Reply to #5)
Locutus

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

Tue, 06/10/2008 - 20:56
SteveHeinsch

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

Tue, 06/10/2008 - 21:50 (Reply to #7)
sgrayban

That should work

Topic locked