[mod_python] "Can't locate API module structure" on OS/X Leopard

James Dean james_dean at comcast.net
Fri Jan 23 07:10:56 EST 2009

I have looked through many emails on this subject, and tried the  
suggestions, but I still can't get mod_python loaded into Apache2 in  
OS/X Leopard.

I am trying to start up apache2, with mod_python, and I am getting  
this error:

======================= Here is the error: =======================

c-24-61-41-158:apache2 root# httpd -t
httpd: Syntax error on line 124 of /private/etc/apache2/httpd.conf:  
Can't locate API module structure `python_module' in file /usr/libexec/ 
apache2/mod_python.so: dlsym(0x1002091e0, python_module): symbol not  

===================== Hardware, OS ============================

I have:
	- powerPC Mac G5
	- OS/X 10.5.6

====================== So Far ================================

I was able to get past the "no suitable image found" errors, by adding  
additional compile
and link flags, as shown below.

======================= LoadModule ========================

Here is my LoadModule statement:

LoadModule python_module /usr/libexec/apache2/mod_python.so

======================= Flags ===============================

I took advice from other emails and set some flags in src/makefile.   
Here is what I am using:
INCLUDES=-I/Software/mod_python_3_3_1/mod_python-3.3.1/src/include -I/ 
apache2 -I/Library/Frameworks/Python.framework/Versions/2.5/include/ 

LIBS=-lm  -framework  Python    -ldl

CPPFLAGS = -I/System/Library/Frameworks/Python.framework/Versions/2.5/ 

LDFLAGS= -Wl,-framework,Python  -u _PyMac_Error $(PYTHONFRAMEWORKDIR)/ 
ERSION)/$(PYTHONFRAMEWORK)  -isysroot /Developer/SDKs/MacOSX10.4u.sdk - 
g -arch ppc\
7400 -arch ppc64

OPT= -Wc,'-arch ppc64' -Wc,'arch ppc7400' -Wl,'-arch ppc7400' -Wl,'- 
arch ppc64'


LDLIBS= -ldl

======================= Also Tried ======================
I just tried this, at someone's suggestion, but it did not help:

c-24-61-41-158:apache2 root# export DYLD_FORCE_FLAT_NAMESPACE

======================== Mysql, Apache, mod_python   

mod_python 3.3.1

50 / > file /usr/libexec/apache2/mod_python.so
/usr/libexec/apache2/mod_python.so: Mach-O universal binary with 2  
/usr/libexec/apache2/mod_python.so (for architecture ppc7400):	Mach-O  
bundle ppc
/usr/libexec/apache2/mod_python.so (for architecture ppc64):	Mach-O 64- 
bit bundle ppc64

mysql 5.0.51b

52 / > file /usr/local/mysql/bin/mysqld
/usr/local/mysql/bin/mysqld: Mach-O executable ppc

apache 2.2.9

c-24-61-41-158:apache2 root# file /usr/sbin/httpd
/usr/sbin/httpd: Mach-O universal binary with 4 architectures
/usr/sbin/httpd (for architecture ppc7400):	Mach-O executable ppc
/usr/sbin/httpd (for architecture ppc64):	Mach-O 64-bit executable ppc64
/usr/sbin/httpd (for architecture i386):	Mach-O executable i386
/usr/sbin/httpd (for architecture x86_64):	Mach-O 64-bit executable  

Any help would be greatly appreciated!

Thank you,
- Jim

More information about the Mod_python mailing list