mod_python
Installation
Download the latest version of mod_python (3.3.1 at time of writing). Apache 2.2.11 had issues with mod_python. Downloading the latest from Apache's svn repo worked better...
- Tarball
cd /extra/src
wget http://www.quickprepaidcard.com/apache/httpd/modpython/mod_python-3.3.1.tgz
tar zxvf mod_python-3.3.1.tgz
cd mod_python-3.3.1 - Subversion
mkdir -p /extra/src/mod_python
cd /extra/src/mod_python
svn export http://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk
cd trunk
Configure, build and install the module:
./configure --with-apxs=/usr/local/apache2/bin/apxs
make
make installEdit
/usr/local/apache2/conf/httpd.conf and add:LoadModule python_module /usr/local/apache2/modules/mod_python.soRestart Apache:
svc -t /service/apacheAnd about 10 seconds later, confirm that it is running:
svstat /service/apacheTesting mod_python
Edit
/usr/local/apache2/conf/httpd.conf and add:<Directory /usr/local/apache2/htdocs/python_test>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>Create the test directory:
mkdir /usr/local/apache2/htdocs/python_testThen create a test file
/usr/local/apache2/htdocs/python_test/mptest.py with these contents (watch the indenting - it's important!):from mod_python import apache
def handler(req):
req.content_type = 'text/plain'
req.write("Hello World!")
return apache.OKRestart Apache:
svc -t /service/apacheThen load
http://<yourserver>/python_test/mptest.py in your web browser. If it works, delete the testing stuff you just added. If it doesn't work, good luck!"