[mod_python] Getting modpython and php to work on the same computer

Reed L. O'Brien reed at intersiege.com
Thu Mar 10 18:03:45 EST 2005

I think Graham maybe meant this:

which basically says this:

The solution (from David Geller) is as follows:

In my httpd.conf I was loading two DSO modules: mod_python and php4. It 
turns out, when I removed the reference to php4, the mod_python worked 
perfectly. Now, why was this? Well, I went back to the php4 module, and 
checked out "configure" - if you know anything about php, it was being 
configured with the "--with-mysql" flag, which tells it to use an 
"internal" version of mysql libs. Apparently, this is fine - as long as 
*no other modules use mysql* (the php configure tells you this at the 
end). If they do, you should specify the actual mysql library directory. 
Well, mod_python was basically another module using mysql. Duuuuh! 
(well, not so obvious to me, really). When I specified the actual mysql 
library to php configure, and recompiled and reinstalled the PHP, I 
could have LoadModules for both php and mod_python and both /appear/ to 


Graham Dumpleton wrote:

> These problems usually come down to PHP and Python, or some module being
> used by either, being compiled against different versions of some shared
> library. The main culprit tends to be libexpat but there can also be
> issues with MySQL. See FAQ entry:
>    http://www.modpython.org/FAQ/faqw.py? 
> query=PHP&querytype=simple&casefold=yes&req=search
> On 11/03/2005, at 3:37 AM, Jason Lanquist wrote:
>> I've been having problems getting Python/mod_python/MySQLdb to work on
>> my computer at home.  I finally figured out that if I commented out my
>> php module from loading in my httpd.conf file then mod_python would
>> work.  I'm wondering if there is a way to get mod_python to work even
>> when php is loaded.
>> system info:
>> Linux Slackware 8.1 w/ 2.4.22 kernel
>> Apache          2.0.49
>> Python          2.3.3
>> mod_python      3.1.3
>> MySQL-python    0.9.2
>> PHP             4.3.4
>> Specific error:
>> --- from httpd.conf ---
>> LoadModule python_module /usr/local/apache/modules/mod_python.so
>> LoadModule php4_module   /usr/local/apache/modules/libphp4.so
>> --- /from httpd.conf ---
>> Actually, there were no errors reported to the browser.  Mod_Python
>> would silently stop execution and the only evidence of anything strange
>> in log files was an "exit signal Segmentation fault (11)" in my apache
>> error log.
>> --- from httpd.conf ---
>> LoadModule python_module /usr/local/apache/modules/mod_python.so
>> #LoadModule php4_module   /usr/local/apache/modules/libphp4.so
>> --- /from httpd.conf ---
>> If I commented out php4_module in httpd.conf, then everything worked
>> fine in python.  Unfortunately, php doesn't work in this case.
>> I'm able to duplicate this behavior on a different computer with the
>> same things installed so I'm not thinking it's a hardware issue
>> Any help would be greatly appreciated!
>> Jason Lanquist
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list