Snakes and cats

I have a VM running Linux on my MacBook. The main reason being that I could never get mod_python to install into Apache on Leopard. I followed all the instructions I could online. I could always get it compiled, but Apache would always puke when I tried to restart it with the module loaded.

Tonight, the breakthrough.

There are countless blog entries on building mod_python on Leopard, but why not add another one?

  • Get the source (3.3.1 is the newest at the time of writing)
  • When uncompressed, run
    ./configure --with-apxs=/usr/sbin/apxs
  • Open src/Makefile in your favourite text editor
  • Add “-arch x86_64″ to the end of line 27
  • Change line 49 to read “(APXS) $(INCLUDES) -c -Wc,”-arch x86_64″ $(SRCS) $(LDFLAGS) $(LIBS)”
  • Do the make/sudo make install dance
  • Root edit the file /usr/apache2/httpd.conf
  • Uncomment line 116 which should load mod_python.so, however, check that the module is loaded as ‘python_module’

(Update: I think line 116 was there from my last failed attempt at installing mod_python on this machine.)

The last point was the important one for me. There was a default of ‘mod_python_module’ there. Once I changed that, it all worked. I may be talking from my proverbial, but give it a go and tell me how it goes.

Leave a Reply