Simon Willison’s Weblog


PHP and Apache 2.0

31st March 2004

For as long as Apache 2 has been stable, the PHP manual has carried this strongly worded warning:

Do not use Apache 2.0 and PHP in a production environment neither on Unix nor on Windows.

I’ve frequently wondered why they are being so slow to support the new version —after all, Apache 2 provides a bunch of improvements over the older 1.3 and is recommended by the Apache Software Foundation as the best available version.

I finally found the answer today in this comment buried on Slashdot. It seems that one of the key features of Apache 2 is the new threaded worker module which uses threads to serve more requests more efficiently than 1.3’s multi-process based server. While the core Zend engine of PHP is thread-safe many of the critical libraries that PHP relies on for its advanced functionality (image processing, database connectivity and so forth) are not, and are unlikely to become so any time in the future. In a threaded environment PHP is likely to suffer from all kinds of unpredictable bugs. Apache 2 can be run in traditional 1.3-style prefork mode but doing so greatly reduces its advantages over 1.3. Combined with the lack of heavy duty testing on Apache 2 and the fact that the 1.3 series will continue to be supported for a long time to come it’s clear why the PHP team are unwilling to recommend PHP and Apache 2 in a production environment.

This is PHP and Apache 2.0 by Simon Willison, posted on 31st March 2004.

Next: 1GB of webmail from Google

Previous: Omit needless words, codified

Previously hosted at