Making PHP rock on Windows/IIS

********************
UPDATE - 10/30/2006: We have just released the FastCGI Technical Preview for IIS 5.x / IIS 6 / IIS 7.  Read more on my blog post,  and go get it from iis.net.  More blog coverage also on Bill's blog.

********************
UPDATE - 12/31/2006: We have just released the FastCGI Technical Preview 2 for IIS 5.x / IIS 6 / IIS 7.  Read more at Turbo-charge your PHP applications with IIS FastCGI Technical Preview 2.

********************
UPDATE - 09/24/2007: FastCGI GoLive beta for IIS 5.x / IIS 6 is here!  Read more at Deploy your PHP applications today with the IIS 6 FastCGI Go-Live release!

********************
UPDATE - 11/12/2007: FastCGI for IIS 6.0 RTMs on Download Center! Read more at FastCGI for IIS 6.0 is released on Download Center.

********************
The latest matrix of FastCGI releases for Windows XP, Windows Server 2003, Windows Vista and Windows Server 2008 at IIS FastCGI and PHP: What you absolutely need to know to host PHP applications on IIS 6 and IIS 7.

Right as I was about to go home, one of our developers comes in to tell me some good news about our new IIS7 FastCGI module.  So, I figure I would shed some light on our recent work to improve hosting PHP (yes, you read right, PHP) applications on Windows/IIS. 

The IIS team is committed to providing production quality support for PHP applications, which is currently lacking on the Windows platform.  It turns out, while 70%+ of PHP developers develop on Windows, actually hosting PHP applications on Windows is not recommended by the PHP community for production.  Why? 

Here is the reason:

IIS is a multi-threaded web server, because multi-threading is really the only way to achieve high-concurrency high-performance server applications on Windows (processes aren’t as cheap as they are on Nix).  ASP.NET, ASP, and other IIS application frameworks and components are all thread safe, and the IIS extensibility model is designed to allow high-performance / asynchronous processing.  PHP has not been designed with multi-threading in mind, and while today the PHP core is thread safe (http://www.php.net/), many extension libraries PHP applications use are not and therefore cannot be reliably hosted in a multi-threaded environment.  You may get lucky, but unless you are making sure the extensions you are using are thread-safe (except for extensions bundled with the PHP core distribution, I cannot find any list of known-safe extensions anywhere), you are sure to hit deadlocks and memory corruption when running PHP in multi-threaded mode with the PHP ISAPI extension for IIS.

The only supported single-request-per-process option on Windows/IIS today is to use CGI (http://www.w3.org/CGI/).  In a nutshell, CGI hosts spawn a new application process for each incoming request, send in request data via environment variables/stdin, receive the response back via stdout, and kill the process.  Result - the performance on Windows is horrendous! 

So, we set out to build a FastCGI host for PHP, which is another commonly supported mode for PHP applications that uses the next generation FastCGI protocol (http://www.fastcgi.com/devkit/doc/fcgi-spec.html), that still allows for a single request per process execution but maintains a pool of reusable processes.  This should be quite promising according to our internal test results, and I cannot wait until it’s ready for primetime. 

Bill Staples and I gave the first public preview of our work to make PHP rock solid on the Windows/IIS platform to a number of key PHP developers last week … I demoed our brand new native response caching feature in IIS7 that launched the throughput of my sample dynamic PHP app (QDIG) from 40 RPS to 1600+ RPS (it was client bound at that point, so I couldn’t even come close to maxing the server). 

Here is some early news coverage of the event: http://searchopensource.techtarget.com/columnItem/0,294698,sid39_gci1218130,00.html. 

The article quotes me as saying “nothing concrete has come out of this yet” – but something concrete is definitely coming.
  For starters, our FastCGI PHP host platform that should get us most of the way there.  There are definitely other things we need to do to make the experience rock end to end, including providing support for commonly-used Apache features like mod_rewrite for url rewriting, and a number of others, but one thing is clear - PHP on IIS7 is going to kick ass!

If you have any ideas / specific suggestions for how we can make PHP run better on Windows, please don’t hesitate to comment.

Stay tuned for more updates on this effort.

Published 29 September 06 08:51 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

# Will Green said on December 19, 2006 3:04 PM:
Posted on 10/8/2006 6:56 PM:

How about Ruby via FastCGI? More specifically, Rails. Rails is not thread-safe, and many Rails sites still rely on FastCGI (though thats changing with load-balanced proxying to a group of application servers, a.k.a Mongrel). If your FastCGI implementation works well for PHP, it could be a way to bring Ruby and Rails goodness to the IIS platform.
# Mike Volodarsky said on December 19, 2006 3:04 PM:
Posted on 10/8/2006 7:53 PM: Exactly right. While I cannot promise anything, the FastCGI module should work for any FastCGI compatible executable, including RubyonRails. More on this later ...
# Chris Kempton said on December 19, 2006 3:05 PM:
Posted on 10/22/2006 5:17 PM:

What improvement will this represent over the current Zend Core distributions for use with IIS 6? I believe they also use FastCGI.
# Mike Volodarsky said on December 19, 2006 3:06 PM:
Posted on 10/31/2006 10:25 AM:

We should be faster. The main idea though is to have this platform level technology come from the IIS team, so that we can innovate it together with the platform (such as coverting it to an IIS7 module on top of the new IIS 7 extensibility APIs that provide numerous advantages), provide richer features, and support it with the product in the future.

Zend Core distributions will continue to provide improvements to the core PHP engine that should futher improve the performance and stability of PHP on Windows / IIS, and be able to leverage the IIS-level improvements of our FastCGI support to provide the best-ever support for PHP on Windows.

Check out the update to the post with links to the FastCGI technical preview that we just released today, and the new Zend Core For Windows technical preview from Zend.
# Dennis said on October 21, 2007 10:44 PM:

Now you can. Microsoft has released a SQL 2005 Driver for PHP CTP. It is a PHP5 extension that allows

# Email Filtering Services said on December 11, 2007 5:27 PM:

As you're looking for managed email service pages and information, be certain to utilize everyone of the sources at your disposal.

# Top 10 Web Hosting Services said on March 21, 2008 8:51 PM:

Some web hosting companies are so sure of their services and products, they are willing to offer clients access to very cheap fees if they sign on for long- term contracts. While cheap web hosting 10 year contracts can save site owners a great deal of

# IIS 7.0 Server-Side said on May 14, 2008 2:52 PM:

After almost 5 years at the company, I am both sad and excited to say that I’ll be leaving the

# IIS 7.0 Server-Side said on May 14, 2008 6:04 PM:

After almost 5 years at the company, I am both sad and excited to say that I’ll be leaving the

# MVolo's Blog said on May 14, 2008 7:33 PM:

After almost 5 years at the company, I am both sad and excited to say that I’ll be leaving the IIS team and Microsoft at the end of this week. Looking back, I can say that my experience at Microsoft has been truly amazing

# Barry said on May 15, 2008 4:27 PM:
Would you be able to tell me if this information is still current? Is there anywhere with update info? Thanks
# parke said on September 4, 2008 9:37 AM:
thank youu
# rüya tabiri said on September 4, 2008 9:38 AM:
thank youu
# Build Outdoor Fireplace said on September 15, 2008 10:24 AM:

A) First let’ s think of offline publishing: Don’ t try sending your articles to your local trade magazines, as potential clients do not read them. Send them to magazines or newspapers that your potential clients may read. Send it to the local newspaper.

# wan accelerator said on December 2, 2008 4:07 AM:

Internet Security and Acceleration (ISA) Server 2004 Standard Edition Service Pack 1 (SP1) offers updates and improvements to ISA Server 2004 Standard Edition.

# Cheap Web Hosting said on December 23, 2008 2:23 PM:

We have to ask why web hosting became affordable to so many people when the cost of it dropped. The reason is pretty direct with the increasing demand.

# Internet Unterhaltung said on December 28, 2008 8:05 AM:

Die besten Anbieter sind gratis und ohne Werbung.

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