Why Must PHP Be So Difficult?
Monday, December 22nd, 2008Despite my best efforts, PHP seems to have issues on Lupinia’s server, and I don’t know what to do about it anymore.
When we first moved Lupinia to its new server last January, everything seemed to be working fine with PHP in an IIS environment. However, as time went on, we discovered a problem: After about 100,000 requests to a particular application pool (in IIS, a group of virtual hosts), PHP would suddenly stop responding, and start giving internal server errors, until the application pool was recycled (about a 15-minute process if left to do it by itself). And, every once in awhile, apparently at random, it would take a full restart of IIS to get it working again.
I was able to keep things under control for awhile, but as load increased, so did the frequency of these errors, to the point where it was happening every couple of days. I finally took the time to search for it, hoping that I was doing something wrong, only to find that it was a known bug in PHP’s ISAPI module, and they haven’t done anything about it since 2004. Lovely. The only other built-in option is to run PHP as a CGI application, where it launches an EXE every time a request is sent to it. Unfortunately, in a Windows environment, that equates to obscene loads on the system resources, and it’s not a viable option on a server that hosts the traffic we do.
After some searching, I found the answer in the Zend Core, a corporate-grade PHP installation for IIS. It has an interface called FastCGI, which is the best of both worlds in this case; it has the stability of a CGI application, but it only launches one EXE per virtual host (which is still a large number, but manageable). Everything has been working quite peachy in the few months since we upgraded, except for one problem; instead of PHP errors giving error messages in the page generating them, they result in a generic Internal Server Error.
Until recently, I didn’t really have the time to look into fixing it. But, this weekend, I’ve been working on a project that’s really pushing the limits of my abilities (in a good way, this is how I learn new things), which means little errors here and there. And, I’m getting really tired of blind debugging.
And, unlike the previous problem, Google has been no help whatsoever. I’ve spent the last two hours searching for possible causes, and tweaking config variables. All of the search results I’ve found have been irrelevant in some way.
I really don’t want to spend $500 for a support package from Zend (the software is free, but they charge out the nose for support).
