Jump to content

How to set IIS 7 to parse .HTM files as .PHP?


Recommended Posts

I tried changing the MIME type of .HTM to:

 

Extension: .htm

MIME-Type: application/x-httpd-php

 

But the htm pages still don't recognize the PHP in the .htm files. I changed the .html MIME too, but still no go.

 

Is there something in PHP.INI I need to switch on?

Link to comment
Share on other sites

Make sure FastCgiModule is installed. You should have configured that during PHP install. If not, there are a lot of how-tos out there for that.

 

[*]In IIS Manager

[*]Navigate to the folder you want to add the rule to.

[*]In the IIS section, double click Handler Mappings.

[*]In Actions, click Add Module Mapping...

[*]Request Path: *.htm

[*]Module: FastCgiModule

[*]Use quotes for the Executable: "C:\Program Files (x86)\PHP\php-cgi.exe"

[*]Name: PhpInHtml

 

Success!

 

BTW, I removed the MIME type. All you need to do is the above.

Link to comment
Share on other sites

NOTE: It only worked for me when I applied it to the entire web site (Default Web Site) level. It didn't work by adding Handler Mappings at the folder level. And make sure that your subdirectories are set to inherit from the Parent. In Handler Mappings, you'd need to click "Revert to Parent" if you have custom mappings.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.