Post Reply  Post Thread 
Mod_python Installation
Author Message
Nilesh
Super Moderator
******


Posts: 42
Group: Super Moderators
Joined: Jul 2007
Status: Offline
Reputation: 0
Thank 0
0 was given thank in 0 posts
Post: #1
Mod_python Installation

This is a simple guide to install mod_python running Apache 1.3.x. You need to have Python installed for this to work - most RHEL+cpanel boxes have this installed by default.

1) Download and extract Python:

Quote:
cd /usr/local/src
wget http://apache.dataphone.se/httpd/modpyth...2.7.11.tgz
tar zxvf mod_python-2.7.11.tgz


2) Configure & install Python

Quote:
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:

Quote:
LoadModule python_module libexec/mod_python.so


Now locate your AddModule - section by pressing CTRL-W and typing "AddModule". Add the following line under the others:

Quote:
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:

Quote:
mkdir python


Now open pico and write the following lines:

Quote:
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

Quote:
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

Take your browser to http://www.mydomain.com/python/testingpython.py and you should see "Hello World!" If you can see this message then you have succesfully installed Python.


~~~ Cool Buddy ~~~

ADD TO DEL.ICIO.US  ADD TO DIGG  ADD TO FURL  ADD TO NEWSVINE  ADD TO NETSCAPE 
ADD TO TECHNORATI FAVORITES  Technorati ADD TO SQUIDOO  ADD TO WINDOWS LIVE  ADD TO YAHOO MYWEB  ADD TO ASK 
ADD TO REDDIT  ADD TO STUMBLEUPON  ADD TO GOOGLE   

07-15-2007 10:38 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Mod_Security installation Nilesh 0 365 07-15-2007 10:41 AM
Last Post: Nilesh
  Mod_evasive Installation Nilesh 0 280 07-15-2007 10:32 AM
Last Post: Nilesh
  mod_bandwidth Installation Nilesh 0 282 07-15-2007 10:30 AM
Last Post: Nilesh
  Mod_auth_mysql Installation Nilesh 0 229 07-15-2007 10:27 AM
Last Post: Nilesh

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: