IIS FastCGI and PHP: What you absolutely need to know to host PHP applications on IIS 6 and IIS 7

*************************
UPDATE: NOV 12, 2007: FastCGI RTM for IIS 6.0 / Windows Server 2003 is released on download center.
*************************

Everybody knows that IIS FastCGI is a great way to run PHP applications on IIS.

So, if you are looking to give FastCGI a try, where should you start?

The good news is that we've been making great strides at delivering a solid production experience for hosting PHP on IIS, for both IIS7 on Windows Vista/Windows Server 2008 and IIS6 / IIS5.1 on Windows Server 2003 and Windows XP.  This means that with high likelihood you can take advantage of this right away, even if you do not have access to the latest and greatest IIS7 build.

With all the coverage this work has been receiving, its starting to get out of hand.  Here is the information you absolutely need to know to get started:

If you run Windows Server 2003:

            Download the FastCGI RTM (released 11/12/2007)

            Docs at: www.iis.net/fastcgi

            My earlier blog post: FastCGI for IIS 6.0 is released on Download Center

If you run Windows XP:

            While the FastCGI RTM will work on Windows XP, it is not officially supported due to Microsoft software lifecycle policies.  I am bummed about it, but nothing we can do.  

            However, you should still be able to download and use it for development and testing on your XP machine (until you upgrade to Vista SP1).

If you run Vista:

            Download the FastCGI Techical Preview 2 release (released 1/31/2007).
            Starting with Vista SP1, and Windows Server 2008, FastCGI is no longer an out of band
            download, and is instead included with IIS7.  There will be no more out of band FastCGI updates
            for Vista.
            
            My earlier blog post: Turbo-charge your PHP applications with IIS FastCGI Technical Preview 2

            DOC: Installing PHP with the FastCGI technical preview.

If you run Vista SP1 beta or later:
AND
If you run Windows Server 20058 BETA3, RC0, or later:

            FastCGI is built-in!
 
            My earlier blog post: The latest on the FastCGI project and PHP support on IIS

            DOC: Using FastCGI to host PHP applications on IIS7.

You also should download and try the latest PHP build available from www.php.net/downloads. Starting with PHP 5.2.1, Zend has worked together with us to significantly improve the performance of the PHP engine itself on Windows, in addition to the platform improvements provided by FastCGI.  The current build is 5.2.4. 

Be sure to download a non-thread-safe build flavor for use with FastCGI, as this will give you a significant boost over thread-safe builds needed for the PHP ISAPI.

Hopefully this helps make sense of what's available, and gets you on your way.  Be sure to come back to the blog for more PHP/FastCGI news/info.

Thanks,

Mike

Published 09 October 07 01:20 by Mike Volodarsky
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# iis said on October 9, 2007 3:09 PM:

Everybody knows that IIS FastCGI is a great way to run PHP applications on IIS. We've been making great

# Jonathan Puddle said on October 12, 2007 7:58 AM:
lol, are you sure "everyone knows"? Seems like no one knows...
# Jonathan Puddle said on October 12, 2007 7:58 AM:
That said, I am really thrilled to try this out. Good work!
# Mike Volodarsky said on October 12, 2007 4:26 PM:

Yes, I'd say a lot of people know :) There has been a great deal of talk and excitement around this, but this post is really about the straight facts to help people get started.

# John Rich said on October 26, 2007 6:08 PM:
I have no problem running applications such as phpBB with php5ISAPI.dll ? Can you tell me why fast cgi is better?
# Mike Volodarsky said on October 27, 2007 2:01 AM:

Hi John,

The main reason why ISAPI is not an adequate solution is the lack of thread safety in many popular PHP extensions.  The PHP core itself is thread safe, and so are some of the extensions, so its possible that some applications will work correctly in the ISAPI environment.  However, many production environments do experience instability with the ISAPI.  You can read more about this in my original post: http://mvolo.com/blogs/serverside/archive/2006/09/29/Making-PHP-rock-on-Windows_2F00_IIS.aspx.

Thanks,

Mike

# Aaron Smith said on November 30, 2007 1:08 PM:
I found out about this my just searching through the 2003 Updates Database. I was really surprised to see this option for IIS, now I can work more efficiently instead of having to run Linux or Apache! This is really cool. Great way to mix up scripting and application on one server instead of many.
# Felix said on December 19, 2007 3:38 AM:
Some 6 months ago I tried FastCGI in Vista 64-bit. It was quite painful; I think I ultimately got it to work... or almost to work, but I wouldn't want to try it again. Is PHP / FastCGI is as mature as x86 version?
# Antonio said on January 6, 2008 3:06 PM:
Several PHP Apps required Apache "mod_rewrite". We can read about several PHP Apps at http://www.iis.net/phpapps, but not a word about this requirement. I read about some 3rd solutions like "IIS Mod-Rewrite Pro" that we have to buy. There is a Microsoft Solution? I don't want to use in our Production Server a 3rd solution but how can we use Fastcgi/PHP5 with some real Apps like DRUPAL without "mode_rewrite"?
# DoctorScience said on January 9, 2008 8:58 PM:
Should I remove or disable ISAPI before enabling FastCGI? I'm running IIS7 on Vista Business.
# Mike Volodarsky said on March 6, 2008 8:52 PM:

You dont need to do that, although, it is recommended - it can help avoid creating confusing handler mapping configuration where you may be accidentally using Isapi instead of FastCGI and visa versa.

FastCGI is a more reliable way to host PHP applications so you should theoretically never install the ISAPI. If you follow the installation instructions in one of the linked articles, it will walk you through installing PHP with FastCGI without using the PHP Windows installer which may generate ISAPI configuration.

Thanks,

Mike

# mumu said on March 21, 2008 6:46 PM:

Mr  Program Manager  you have so many errors in links and text that I doubt IIS7 will work under your "management" Server 2006 what that means dude?

# John Wielki said on March 22, 2008 1:00 PM:
I just installed Vista SP1. I want to enable PHP, using the instructions on IIS.net. The instuctions say that FastCGI is included in SP1. When I go into IIS manager and click "Handler Mappings", then click "add module mapping" (which is in the instructions), the dropdown list of modules does not contain an entry for fastCGI. I have rebooted a couple of times, and Vista says that its version is SP1, but I don't see the fastcgi module. Am I doing something wrong?
# Mike Volodarsky said on March 24, 2008 10:39 AM:

Hi mumu,

Thanks for spotting the "Windows Server 2006" typo, I fixed it.  All other links are working - what other errors did you see?

As far as your other concern, IIS 7.0 is "working" pretty well so far, be sure to try it :)

Thanks,

Mike

# Coolhand said on April 30, 2008 9:58 AM:
Thanks for the efforts to get PHP and IIS7 to be good neighbors; I am trying to get PHP 5.2.3 ro work on IIS7 I still have an issue getting PHP to work on my Vista Business installation - using the fastCGI or the IIS-ISAPI modules as suggested by bill's blog on IIS.net. From localhost i call mytest.php, - then the page just hangs... - and no IIS error apge or HTTP40X.X error returns any suggestions?
# Mike Volodarsky said on April 30, 2008 6:22 PM:

Coolhand,

Can you get a simple hello world php script working, or does it also hang?

Be sure that you are creating the FastCGI mapping to php-cgi.exe, not php.exe. If you configure a random process that doesnt support FastCGI to be used with FastCGI, it may exibit hanging.

If it doesnt help, post on forums.asp.net and we'll help you more.

Thanks,

Mike

# Mibble said on June 14, 2008 2:39 PM:
i have 2k3 and iis6, main site works fine however a 'cname' site does not. no matter whici one i use all i get is the phpinfo page displayed. and i have other url info chosen ie index.php or install.php, same thing. perhaps i have done something wrong?
# Mibble said on June 14, 2008 2:39 PM:
i have 2k3 and iis6, main site works fine however a 'cname' site does not. no matter whici one i use all i get is the phpinfo page displayed. and i have other url info chosen ie index.php or install.php, same thing. perhaps i have done something wrong?

Leave a Comment

(required) 
(optional)
(required) 
Enter the code you see below


About Mike Volodarsky

For the past 5 years, I was the core Program Manager for Microsoft ASP.NET 2.0 and IIS 7.0 products. I drove the design and development of the IIS 7.0 web server core, the IIS FastCGI support, the AppCmd command line tool, the ASP.NET Integrated pipeline, and other special projects around server security, performance, and scalability. Now, I am working on my own on cutting edge web server tech on top of the Microsoft IIS platform, and continue blogging about it here.

About me



For the past 5 years, I was the core server Program Manager for the IIS 7.0 and ASP.NET 2.0 products at Microsoft.
Now, I work on advanced web server tech using IIS 7.0, .NET, and Windows Server 2008 and write about it in this blog.

View Michael Volodarsky's profile on LinkedIn

Writings



TechNet Magazine
>Top 10 Performance Improvements in IIS 7.0

MSDN Magazine
>IIS 7.0: Build Web Server Solutions with End-To-End Extensibility
>IIS 7.0: Enhance Your Apps with the Integrated ASP.NET Pipeline
>IIS 7.0: Explore The Web Server For Windows Vista And Beyond
>Design and Deploy Secure Web Apps with ASP.NET 2.0 and IIS 6.0
>Fast, Scalable, and Secure Session State Management for Your Web Applications


Tools and Modules

LeechGuard
IconHandler 2.0
DirectoryListing
HttpRedirection
IIS Auth for Wordpress
iisschema.exe
PortCheck.exe v2.0

Popular Posts

- ASP.NET 2.0 Breaking Changes on IIS 7.0
- Develop IIS7 modules and handlers with .NET
- Troubleshoot IIS7 errors like a pro
- Troubleshooting 503 / "service unavailable" errors
- Troubleshooting "server not found" errors
- Create IIS7 sites, applications, and virtual directories
- Run Ruby on Rails with IIS FastCGI
- VS Debugging of ASP.NET applications on Windows Vista
- Stop hot-linking with IIS and ASP.NET

Tags

Search

Go

This Blog

Archives

Good IIS Blogs

Disclaimer

These postings are provided as is with no warranties, and confer no rights. The views expressed in this blog are entirely my own.

Syndication