Apache vs. Apache

Item 1: I use Apache as my web server of choice. I use it on the Queens’ JCR web server (which I built from scratch, fairly standard LAMP setup). My hosting provider uses it (I have no input whatsoever into this, but it’s worth mentioning). I also run it on my own box for serious development and general faffing (“faff” in the sense of waste time, not female genitalia).

Item 2: I use PHP as my current web scripting language of choice. Despite some problems I may have with it, it’s popular and it works. This unfortunately leads us to…

Problem A: PHP and Apache 2 don’t play nicely with each other. Up until recently the PHP site carried a severe warning saying “do not use PHP with Apache 2 or your computer will fall over and die in a myriad different horrific and painful ways” or words to that effect. This has thankfully been amended to the slightly more helpful “we do not recommend using a threaded MPM in production with Apache2”. A slightly more verbose explanation is also offered.

(Brief note: one of the main new features introduced in Apache 2 is the concept of a multiprocessing module – a module which allows Apache to run in whatever exciting combination of separate processes and threads it sees fit. PHP doesn’t get on with the default one of these, leaving the possibility of the aforementioned horrific server-death.)

“All well and good,” we say, “just use a different MPM. I’ve heard this ‘prefork’ jobbie works quite nicely”.

apt-get install apache2-mpm-prefork apache2 apache2-common works fine. apt-get install libapache2-mod-php5 doesn’t. This is because, as PHP5 and Apache 2 have been uncooperative for the life of PHP5, the Debian folks haven’t produced a PHP5 module for Apache 2.

Until now, when a friendly chap has popped up an unofficial apt repository supplying exactly what I’ve been looking for (thanks go to Matt Croydon for spotting it and to Google for spotting him).

I’m a happy geek. Now I just have to try installing it on the odd web server here and there and hope nothing cocks up in the process.

5 Responses to “Apache vs. Apache”

  1. Given that I haven’t really used Apache for very much in recent months (what with being at work for most of it) I’m curious to know what the real benefits of running Apache 2 over Apache 1.3x really are. I mean, I want a webserver with subdomains that’ll run PHP4 and 5. I want mod_rewrite. Is it worth the faffing?

    •  Gravatar for Fatty
    • From Fatty
    • Tuesday 11 January 2005 at 18:21

    Not for your purposes, no. There’s a list of new features up on the Apache site. PHP essentially nullifies the “Unix threading” feature, and “simplified configuration” is nice but not really worth the effort of upgrading. One potentially big feature is that it supports mod_dav which, in turn, has meant that Apache 2 is the only Apache version into which you can plug Subversion. That’s the main reason I want to upgrade, as it means you can leverage all of Apache’s authentication and security mechanisms for Subversion’s benefit.

    •  Gravatar for Fatty
    • From Fatty
    • Tuesday 11 January 2005 at 21:59

    Just upgraded the JCR server to Apache 2. Give or take getting used to the new layout of the configuration files (Apache 2 has ditched the monolithic httpd.conf in favour of a much more pleasant modular approach) and having to install the odd PHP module here and there, it Just Works™ – I’m a double-happy geek.

    •  Gravatar for Jonty
    • From Jonty
    • Wednesday 12 January 2005 at 08:56

    Not quite dead :)

    Just to say I’ve been running PHP 5.0.x on Apache 2 on Windows XP for a few months and it’s been perfect. Admittedly, my setup is a testing environment, not a production one, but nevertheless I haven’t had any problems.

    Kind Regards


    P.S. Methinks testing webdev projects on a Mac OS has finally become viable without remortgaging the house … http://www.apple.com/uk/macmini/

    •  Gravatar for Fatty
    • From Fatty
    • Wednesday 12 January 2005 at 11:20

    According to the PHP site:

    This warning against using a threaded MPM is not as strong for Windows systems because most libraries on that platform tend to be threadsafe.

    I think the problem with concurrency issues is that they’re unpredictable – your system will work fine most of the time, but just occasionally it can go wrong in nasty and unpredictable ways. Admittedly, this will probably only occur when you’re getting a Slashdottian number of hits, but it’s not generally worth the risk.