cPanel: Installing Mod_Python on Apache 2

Rate this post

Note: It is preferred to use mod_wsgi instead of mod_python.

If you want to use mod_python in Apache on a cPanel server, you’ll basically need to compile the module manually and load it into the Apache configuration:

yum -y install subversion (IF it’s not already installed)
svn co https://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk mod_python
cd mod_python
./configure –with-apxs=/usr/local/apache/bin/apxs
make && make install

This will dump the compiled module into /usr/local/apache/modules, which is a standard location, but EasyApache may remove it when you run it again.  So it’s best to copy it to another location, for example:

mkdir -p /usr/lib64/httpd/modules/
cp /usr/local/apache/modules/mod_python.so /usr/lib64/httpd/modules/

Create the file /usr/local/apache/conf/includes/mod_python.conf and add the following line:

LoadModule python_module /usr/lib64/httpd/modules/mod_python.so

Then restart Apache.

zp8497586rq

1 Comment

  1. Pingback: Python on cPanel/WHM - cPanel Forums

Log in