(Adopted from JessCoburn.com)
Last year I attended the San Francisco WordCamp because I wanted to see what the Core WordPress team had to say about WordPress Hosting on Windows. Sadly, it was my experience there that they’re still not very Windows friendly. I personally believe it’s one of two reasons:
- There’s still this mentality that Microsoft is Evil and out to shut down all things open-source. I wonder if they’ll ever escape from their past. But this is the classic Open-Source versus Commercial Software debate. Good luck if you get into one of those debates..
- There’s still this ASP/ASP.NET on Windows, PHP/PERL on Linux (okay maybe it’s Ruby today, whatever).
Now, since 2007 Microsoft has been working closely with Zend to make PHP performance on Windows a first class citizen. Since that time, they’ve done a number of improvements to PHP but still today the PHP developer community is unaware of these changes and that today PHP runs quite good on Windows.
You see, In the past there was always a performance difference between PHP on Linux and PHP on Windows. I’d love to say PHP on Windows outperforms PHP on Linux but instead I’ll simply say this, In a car race often times it’s not the car that decides who wins the race, it’s the driver. In application hosting it’s very much the same. So here’s a few quick tips on what to do in order to get the best possible performance of your WordPress site on Windows:
Tip #1 Use Windows Server 2008 R2
If you’re going to run PHP on Windows, the first thing you’ll want to do is make sure your running this on a Windows Server 2008 R2 server. This is Microsoft latest build of IIS on it (7.5) and has all the latest improvements on it. So start there.
Tip #2 Use FastCGI
In a nutshell, when you execute a CGI based application like a PHP based application, each time it’s run it has to fire up a new process. This means everything PHP needs has to be loaded for that page call and then unloaded. On the next page call, this all happens again. FastCGI, allows CGI applications like (PHP and WordPress) to use the same process so you avoid that load up and unload of the PHP engine every time, it’s already there resident in memory just waiting for the app to be called. http://www.iis.net/download/FastCGI
Tip #3 Use non-thread-safe libraries for PHP
This is a big one. PHP was always released for windows with thread safe libraries because Windows is a multithreaded architecture. However, when calling a CGI application from within IIS, a multiprocess architecture (similar to Linux) this contributes to slow performance. By using the non-threadsafe libraries we get around this. http://windows.php.net/