Configuring and Testing mod_python with Apache on OES11

  • 7014026
  • 31-Oct-2013
  • 31-Oct-2013

Environment

SUSE Linux Enterprise Server 11 Service Pack 3
SUSE Linux Enterprise Server 11 Service Pack 2
SUSE Linux Enterprise Server 11 Service Pack 1
Novell Open Enterprise Server 11 (OES 11) Linux Support Pack 1

Situation

How to configure and test mod_python with Apache on OES 11.

NOTE:  This TID assumes that python in already installed.  Further this TID is not meant as a programming guide, it is only meant to document what steps are needed after Python is installed to get it to work with Apache on OES 11

Resolution

Here are the steps to configure mod_python with Apache on an OES11 SP1 server.
1. Verify Python has been installed.  From the command prompt type in python and hit enter

If the above prompt is seen, the Python interpreter was successfully installed on the server.  
2. Ctrl-D to exit the Python interpreter (note this is not case sensitive )
3. Launch Yast | Software | Software Management
4. Type python into the Search Phrase field and hit enter.  A list of Python modules should be returned, showing which modules have already been installed.  Look at the list for apache2-mod_python, if it has NOT been installed, select it and install it.

5. Exit out of Yast
6. Edit the /etc/sysconfig/apache2 file and add python to the list of modules:
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 proxy proxy_ajp rewrite python"
7.  Add a Python test handler at the end of the /etc/apache2/default-server.conf file:

<Location /pytest>
        setHandler mod_python
        PythonHandler mod_python.testhandler
</Location>
NOTE:  Information on adding the testhandler was obtained from Paul Osman's Introduction to mod_python: http://paulosman.me/2007/01/01/introduction-to-mod_python.html
8. Restart Apache with the rcapache2 restart command.
9. From a browser navigate to your Apache2 server with the location added in step 7, i.e. http://myserver/pytest

If something similar to the above is displayed, mod_python in Apache is functioning properly.