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.


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

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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