Apache 2.2.4 Universal Binary

February 3, 2007

Long story short, I needed a server-side Python interpreter. For this there’s two options (that I know of) - install Zope and run it along or in place of your existing web server (probably what any intelligent being would do), or go the hard way and run mod_python instead. The latest version works with either httpd 2.0 or later so it won’t run OOtB on OS X. I figured since I’m upgrading my Apache anyway, I may as well grab the latest version. Turns out there’s actually no OS X package out there for that (not counting the XAMPP monster, which is Intel-only). OK, no biggie I’ll roll it myself - and why not make it UB as well.

> ./configure --prefix=/usr/local/httpd-2.2 --enable-isapi --disable-mem-cache --enable-mime-magic --enable-ssl \

--enable-http --enable-dav --enable-cgi --enable-rewrite --enable-so --enable-headers --with-ldap --enable-dbd \

--enable-auth-digest --enable-authnz-ldap --enable-authn-anon --enable-mods-shared=most --enable-ldap --enable-cache

I think those features should make it more or less usable also in a real server environment.

Then, due to a bug in GNU libtool, you have to manually replace all the _sys_lib_search_pathspec lines in two files - srclib/apr/libtool and srclib/apr-util/xml/expat/libtool to

sys_lib_search_path_spec="/Developer/SDKs/MacOSX10.4u.sdk/usr/lib"

After compiling and installing I had to go through the config files to make it more of a drop-in replacement for Apache 1.3. So that it works nicely with what’s already there without actually replacing anything. Simply start with config/httpd.config and work through it and all the included files to check for any “incompatibilities” with OS X (document rooot, the www user, homedirs, tmp dirs, the usual).

Finally you just need an interface to control the server. Some fancier distros come with PrefPanes, mine simply has a StartupItem with the service name “Apache 2.2”. You set this up by adding something in /etc/hostconfig (like APACHE22=-YES-) and then the relevant StartupItem into /LibraryStartupItems. So finally, to start our new server:

> sudo SystemStarter start "Apache 2.2"

You can’t use launchd because it’s not appropriate for wrapping things like _apachectl.

Currently things seem to run nicely, I’m still testing stuff before maybe building a package. WebDAV works, which is nice.

It’s incredible how many things you have to keep in mind to finally get a successful build out, a lot due to the fact that configure scripts don’t seem to do any sanity checking between the different switches. For example, you can enable DAV, but if you forget to add any auth modules, nothing will work. Or the fact that –with-ldap and –enable-ldap are two different things - and you only find out that the first one (which isn’t even mentioned in –help, btw) is compulsory if you want to add any kind of LDAP support. It took a lot of TTA to finally get this far…