Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm moving a PHP app to my IIS 7 web server.

A lot of the files in the application are php files, but don't have the php extension (in fact they have no file extension). This works fine on the old Apache hosting, but I can't get it to work on IIS 7.

I've been trying to modify the handler mappings, but I don't know how to map files with no extension to the PHP handler.

I tried just using *, but as I suspected static files like jpegs were also run through PHP and it didn't like this.

Thanks for your help.

share|improve this question
up vote 1 down vote accepted

You are probably going to have to add another handler for the files that you don't want the PHP executable to try and parse. I don't know how to tell the PHP interpreter to not interpret certain files based on extension.

share|improve this answer
This is a possible answer, but it doesn't seem very future proof and it's such a big project that I'm unsure about all the file types it already contains. I'm sure there must be a nicer way to do this. – Richard Jan 30 '10 at 20:08
I tried to upvote this, but it seems I was too slow and it won't let me unless you edit it. Make an edit and I'll give you the upvote you deserve. And sorry for being slow. – Richard Feb 1 '10 at 12:34
When I say edit, I mean a simple style edit. Not change your answer. – Richard Feb 1 '10 at 12:39

The standard way to do this is to add a mime type and handler for *. files, however as you have pointed out, this will result in all files not already covered by a handler being handled by PHP, which is not what you want.

I guess the only options I can think of are to either do that and then add handlers for all the files you don't want PHP to handle or adding extensions to this files. If there are alot of them you could perhaps use a find and replace utility to add file extensions.

share|improve this answer
It's more of a future proofing issue and not being sure of all the file types currently being used. It's starting to look like the best option though. – Richard Feb 1 '10 at 12:37

You need to make sure what module is used in Apache and how is the handle mapping is implemented in PHP on Unix to port it successfully in IIS 7.

Using FastCGI to Host PHP Applications on IIS 7.0. This should help..

PHP Handler Mapping. Just take care of the Handler Mapping section.. and PHP should work.

share|improve this answer
I have this set up fine already for the php extension. I need to do it for files with no extension. – Richard Jan 30 '10 at 20:06
You just have to replace *.php in the screenshot above to *. Let me know if that helps. – Vivek Kumbhar Jan 31 '10 at 12:13
I also tried using *, but static files like jpegs were also run through PHP and it didn't like this. – Richard Jan 31 '10 at 13:19
I would also take a Failed Request Tracing (FREB) to understand if PHP module is initiated and if there is any failures.. then the exact state of the pipeline. – Vivek Kumbhar Feb 1 '10 at 14:11

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.