Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed apache and PHP from Yum on CentOS 6.3

I'm trying to get PHP to be parsed in .html files-- but I can't seem to figure it out.

I have set AllowOverride All in httpd.conf

and then in .htaccess in the root directory I tried adding the line

AddType application/x-httpd-php .html

But that doesn't work. I've spent a while on Google trying different things, but I can't seem to get it. Everytime I view the source of my .html page in the browser, it displays my PHP code instead of parsing it.

Any help would be greatly appreciated.

share|improve this question

Do you have enabled mod_php? Files with .php extensions Apache recognize and parse right?

share|improve this answer
Yes. Apache recognizes and parses normal .php files. – mrc0der Feb 2 '13 at 0:30
You use PHP as CGI? Try to 'AddHandler application/x-httpd-php .html' – klocek Feb 2 '13 at 13:21
I've tried adding the following to my httpd.conf and restarting apache. none of these have worked: AddHandler application/x-httpd-php .html AddType application/x-httpd-php .html AddHandler application/x-httpd-php5 .html AddType php .html AddHandler x-httpd-php .html .htm – mrc0der Feb 3 '13 at 1:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.