Categories: Hostripples Featured

mod_python Installation

cd /usr/local/src

FOR APache 2
wget http://apache.hoxt.com/httpd/modpython/mod_python-3.3.1.tgz

FOR Apache 1
wget http://apache.hoxt.com/httpd/modpython/mod_python-2.7.11.tgz

2) Configure & install Python
cd mod_python-2.7.11
./configure –with-apxs=/usr/local/apache/bin/apxs (check where your apxs is by typing: locate apxs)
make
make install

3) Configure Apache
pico -w /usr/local/apache/conf/httpd.conf
Locate your LoadModule – section by pressing CTRL-W and typing “LoadModule”. Add the following line under the others:
LoadModule python_module modules/mod_python.so

Now locate your AddModule – section by pressing CTRL-W and typing “AddModule”. Add the following line under the others:
AddModule mod_python.c

4) Installation done, now time for testing!
First go to your public_html directory. Make a test directory for Python by typing:
mkdir python

Now open pico and write the following lines:
AddHandler python-program .py
PythonHandler testingpython
PythonDebug On

save the file as .htaccess.

Now open up pico again and copy/paste the following lines:

from mod_python import apache

def handler(req):
req.send_http_header()
req.write(“Hello World!”)
return apache.OK

close and save as testingpython.py.

Now restart Apache by typing: service httpd restart


HR-ADMIN

Recent Posts

The Ultimate Guide to WordPress Maintenance: Tips and Tricks

When you’re running a business that relies on website traffic and sales to succeed. Then you need to keep it…

4 days ago

Migrate In 2024: Our Comprehensive Website Migration Manual to the Next Level

Migration! Yes, this word is very big in the web hosting industry and it has its importance. Especially for businesses…

6 days ago

Unveiling the Importance of Server Maintenance Plans: A Comprehensive Guide

The server is the backbone of the web hosting industry and it acts like a HERO in the web hosting…

2 weeks ago

IP Address is Blocked? A handpicked list of Solutions to Fix it?

Imagine you are on holiday having a cup of tea and browsing your website or blog.Then, what next?You will get…

3 weeks ago

Explained: Difference between Nameservers Vs. DNS

The web hosting industry is growing every minute, day, and year. It has many terminologies that are important to understand…

1 month ago