Allow me to share my woeful experience with Apache and mod_python, in the hopes that I can spare at least one person from the same ordeal. Don't worry, it has an almost-happy ending.
Let me start with a disclaimer of sorts: I run FreeBSD and don't use the ports collection. I like compiling my own software. I like being able to upgrade before there's a port. I like not having to see a list of 4 different gettext
versions in pkg_info
(actually, I like not seeing anything in there). And I like being able to define my own directory structure, however silly it may be. So please, before you ports people get on me: I know.
To dive right in, mod_python's configure
script fails if you are running bash 3.1. Worse, it fails with a syntax error that provides little clue as to how to fix it:
./configure: line 3427: syntax error near unexpected token `('
./configure: line 3427: ` as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`'
A quick google search showed that this issue was known and resolved. Great. So I applied the patch, and… syntax error. Fuck it, I decided I just wouldn't use bash. But somehow the configure script kept finding and using bash, regardless of which shell I was using. So I logged into an account whose default shell is tcsh
, renamed the bash
executable to bash.tmp
and had at it.
Success! Sort of. Everything configured, compiled, and installed without a hitch. The hitch came about 2 minutes later when I restarted apache:
/usr/local/apache/modules/mod_python.so: undefined symbol: APR_STATUS_IS_SUCCESS
Another google search. Another patch. Another configure/compile from a separate account after renaming bash
. This time, however, apache started up and things were good.
The heartbreaker
I fired up this site under mod_python, and everything came up fine… except the pictures. No stack traces, no errors, it just wasn't working. Each time a request was sent for picture information, apache's child handler would segfault. After half an hour of debugging, I narrowed the problem down to parsing the XML results from the Flickr API. Why would XML parsing suddenly break under mod_python? This is why.
Download the correct version of expat. Configure, compile, install locally. Copy libraries into /usr/local/apache/lib
. Relink libexpat.so.1
to the new libexpat.so.5
. And here we are, a working site under mod_python with no segfaults.
Now if they would only fix those import warnings…
Leave a comment