I was just reading Derick’s post about the recent get together with Microsoft, and it occurred to me that so far, I haven’t seen anyone mention anything about the single most important problem with running PHP in production on IIS. After a bit of digging, it looks like the problem has been sorted since the initial IIS 7 release (presumably, if you’re still running Windows Server 2003, you’re still screwed on this one), but I’d love to hear from folks who have definitely done this in production.

Let me explain the background first. When you run PHP apps using IIS, you’re much better off using IIS’s native CGI support (slow, but rock-solid as of Windows Server 2003 SP1) or the new FastCGI support that was released last year or the year before (faster, but I haven’t tested it personally under serious stress, as I’ve managed to move back to working exclusively on Linux this year). I’ve tried PHP via IIS’s ISAPI interface, but as that requires running PHP in a threaded environment, I’ve never had any luck in getting it working in a stable manner over the years. Besides, iirc, both Microsoft and Zend recommend running PHP using FastCGI on IIS anyways.

Running PHP via CGI and FastCGI means that IIS has to do the Windows equivalent of fork()ing off PHP processes to do the actual PHP bit. If your box has too many PHP processes running, the box will start to swap. Once a webserver starts swapping, you’ve no chance in hell of keeping up with all the incoming requests, and your websites on that particular webserver become unavailable in a matter of moments. Restarting IIS will clear off all the PHP processes, but if demand remains the same, the webserver will start swapping again very soon and you’re back to square one – your websites back to being unavailable to the outside world.

With Apache and mpm-prefork, mpm-peruser or mpm-itk, you can adjust Apache’s settings to make sure that your server never swaps. With Apache and PHP/FastCGI, you can do this too by adjusting the number of FastCGI processes created. (Although, atm, I don’t recommend using Apache + PHP/FastCGI in production environments).

But how, exactly, do you do this with IIS and PHP/CGI or PHP/FastCGI? The answer can be found in the IIS 7 documentation. It looks like you can limit the number of FastCGI instances per application pool (IIS best practice is to setup a separate application pool per website. IIS’s architecture is nothing like Apache). That’s fine for servers running just the one website, but is there a way to set a similar limit that applies across all application pools? It would be great if there was. And I’m not sure that there’s a way to do this with CGI, if you have problems with FastCGI crashing.

Love it or hate it, Windows Server is the right choice for many firms, and the better PHP runs in a Windows Server production environment, the more opportunities there are for firms and individuals that create PHP apps in the future.

Be the first to leave a comment »

Job Vacancies at Gradwell

Posted by Stuart Herbert on December 15th, 2008 in News, PHP In Business.

I’m currently looking to fill two new vacancies at our office in Bath. I’m looking for a Senior Sysadmin (permie) and a Storage Engineer (contract) to come in and help us as we grow our award-winning business in 2009. These roles will be assisting us with our email and hosting platforms. If you’re interested, drop me an email. No agencies, please!

Who are we? Gradwell is a rapidly-growing ISP who focuses on broadband, email, web hosting and VoIP solutions for the UK SME market. We are a pioneer in VoIP, and are the leading VoIP provider for UK business. We also do fun things like Twittex, which I talked about recently at the PHPNW 08 conference.

Be the first to leave a comment »

It’s a bit startling to think that it’s already a fortnight since the hugely successful PHPNW 08 conference happened up in Manchester. Where has the last two weeks gone? (Actually, I know exactly where it’s gone – putting together a shopping list for new iSCSI storage, but that’s a different topic). I thought Jeremy et al ran a great conference (the single best open-source conference I’ve been to in the UK so far, and that includes the Gentoo conferences I used to run in Manchester 🙂 ) and I hope they’re able to put on another conference next year. I really enjoyed myself, and I’d forgotten how much I missed going to conferences.

I was there to talk about our experience at Gradwell with building our Twittex service in just seven days. Videos of all the talks will be available from PHPNW once the editing has been finished, but if you can’t wait, my slides are now available. A big thank you to everyone who provided feedback on the talk. If you haven’t done so yet, I’d love to hear what you thought about the talk.

It takes surgery to separate me from a camera, and the PHPNW 08 weekend was no exception. This was my first weekend with my new Panasonic DMC-LX 3 (which I bought on the journey up to the conference). I had great fun putting the camera through its paces, and you can see the results up on Flickr.

Be the first to leave a comment »

This Month

December 2008
« Nov   Jan »