Windows – PHP on Windows as Fast-CGI (IIS vs Apache)

apache-2.2fastcgiiisPHPwindows

We currently have a Windows web server. It's running Apache and PHP as a module. The server itself is a beast but PHP performs poorly in a Windows environment when installed as an Apache module and we're experiencing this first hand.

Anyway, this weekend I plan to reconfigure the server for a FastCGI installation instead and I was going to use IIS7 instead of Apache. Here's the problem though, we have a lot of sites setup with .htaccess files laying around and we weren't interested in cleaning these up to make the sites work properly on IIS.

My question is, does anyone know if PHP installed as FastCGI on Apache has comparable speed to IIS? You can read all over the web how amazingly fast PHP on IIS is, but now we're considering staying with Apache for an easy transition.

If Apache isn't going to be a good option then I guess we'll do the IIS route and just fix up the broken sites, but we kind of want to avoid this if Apache will give us comparable performance using Fast-CGI.

What do you think?

Best Answer

After bench-marking, mod_php was by far the fastest with mod_fcgid being a very close second.

IIS was slower than Apache by a noticeable difference.

If anyone is hitting this from Google search, our slowness problem was due to our database connection using localhost rather than 127.0.0.1. Starting in Windows Server 2008, localhost is no longer in the hosts file (commented out) and instead is resolved through the DNS resolver which is apparently pretty slow.