2

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.

Sam Cogan
  • 38,158
  • 6
  • 77
  • 113
Richard
  • 272
  • 3
  • 18

3 Answers3

2

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.

Goyuix
  • 3,164
  • 5
  • 28
  • 37
  • 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
1

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.

Sam Cogan
  • 38,158
  • 6
  • 77
  • 113
  • 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 01 '10 at 12:37
-1

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
(source: iis.net)
. Just take care of the Handler Mapping section.. and PHP should work.

Glorfindel
  • 1,213
  • 3
  • 15
  • 22
Vivek Kumbhar
  • 3,063
  • 1
  • 17
  • 13
  • 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 01 '10 at 14:11