[mod_python] configuration of mod_python as DSO

Jeff jam at quark.emich.edu
Sun May 14 20:52:44 EST 2000


greetings,

I've done some preliminary work on a RedHat 6.2 box to get mod_python to
compile as a DSO module, and I've so far had limited success-- I'd rather
not have to rebuild apache from sources to get this functionality.

to start, I built the .so with the following command:

% /usr/sbin/apxs -Wl,-export-dynamic -L/usr/lib/python1.5/config \
-I/usr/include/python1.5/ -I/usr/include/apache -c mod_python.c -lpython1.5 \
-lpthread

I then copied the resulting .so module to /usr/lib/apache:
% sudo cp mod_python.so /usr/lib/apache

I then added these lines to the /etc/httpd/conf/httpd.conf file:
LoadModule python_module        modules/mod_python.so
AddModule mod_python.c

The 'LoadModule' directive was inserted in the group of 'LoadModule' lines that
were already in the file, and the same with AddModule. I just put them at
the end of their respective lists.

Since the machine I'm installing this on is not production, I made a
.htaccess file in /home/httpd/html containing the following:
-- begin .htaccess --
AddHandler python-program .py
PythonDebug
PythonHandler test
-- end .htacess --

My 'test.py' file contains the following:
-- begin test.py --
from mod_python import apache

def handler(req):
  req.send_http_header()
  req.write("Hello World!")
  return apache.OK
-- end test.py --

I then restarted apache:
[~] [8:21pm] [jam at toast-pts/2] % /etc/rc.d/init.d/httpd status
httpd dead but subsys locked
[~] [8:21pm] [jam at toast-pts/2] % sudo /etc/rc.d/init.d/httpd restart
Password:
Shutting down http:                                        [FAILED]
Starting httpd:                                            [  OK  ]
[~] [8:21pm] [jam at toast-pts/2] % /etc/rc.d/init.d/httpd status
httpd dead but subsys locked

any clues as to where I might have gone wrong?

regards,
J
-- 
|| visit gfd <http://quark.emich.edu/>
|| psa member -- <http://www.python.org/psa/> 



More information about the Mod_python mailing list