\chapter{VMS installation\label{app-vnsinst}}

\indexii{VMS}{installation}

\begin{verbatim}

How to build and install mod_python on a VMS system

James Gessling <jgessling@yahoo.com> Fri, 3 Nov 2000 

This assumes apache and python already installed successfully.  I tested
Compaq's CSWS version and 1.3.12 version's of Apache.  Python was 1.5.2 from
http://decus.decus.de/~zessin/python.

0) download current release (wrote this for 2.6.3) from www.modpython.org.

1) create directories on a VMS system something like:

dka0:[mod_python.src.include]

2) put the .c files in src, the .h in include

3) Cut the script off the end of this file, save it in the src directory.  
Edit as necessary and use it to compile and link mod_python.exe.  Sorry,
I didn't make much effort to make it very sophisticated.

4) Under your python lib directory, add a subdirectory [.mod_python].

For example: dka100:[python.python-1_5_2.lib]

5) Populate this subdirectory with mod_python .py files.
This allows for module importing like:

    import mod_python.apache

which will find apache.py
\end{verbatim}
\begin{verbatim}
6) Edit apache$root:[conf]httpd.conf to add line:

   Include /apache$root/conf/mod_python.conf

(typically at the end of the file)

7) create apache$root:[conf]mod_python.conf containing:

############################################################################
##
# Mod_Python config
############################################################################
##
#
# Load the dynamic MOD_PYTHON module
# note pythonpath must be in python list literal format
#
LoadModule PYTHON_MODULE modules/mod_python.exe

<Directory />
    AddHandler python-program .py
    PythonHandler mptest
    PythonDebug On
    PythonPath
"['/dka100/python/python-1_5_2/lib','/dka100/python/python-1_5_2/
vms/tools','/apache$root/htdocs/python']"
</Directory>
#

8) put mod_python.exe into apache$common:[modules] so it can be found and
loaded.  (create the directory if required).  

9) fire up the web server with @sys$startup:apache$startup

10) Create a file mptest.py in a python subdirectory of your document root,  
Typically apache$common:[htdocs.python].  Like this:

      from mod_python import apache

      def handler(req):
          req.write("Hello World!")
          return apache.OK 

( watch your indenting, as usual )

11) point browser to:  http://node.place.com/python/mptest.py

12) enjoy "hello world"
\end{verbatim}
\begin{verbatim}
$! build script, edit as needed to match the directories where your
$!               files are located.  Note /nowarning on cc, this is
$!               required because of a #define clash between apache
$!               and python.  If not used, the .exe is marked as
$!               having compilation warnings and won't load. Apache
$!               should already have been started to create apache$httpd_shr
$!               logical name,  Running the apache server with the -X flag
$!               as an interactive process can be used for debugging if
$!               necessary.
$ set noon
$ library/create mod_python_lib
$ cc :== cc  /nowarning/prefix=all/include=(dka100:[python.python-1_5_2],-
                         dka100:[python.python-1_5_2.include],-
                         dka0:[],-
                         dka200:[apache.apache.src.include],-
                         dka200:[apache.apache.src.os.openvms]) 
$ cc  _apachemodule
$ library/insert mod_python_lib  _apachemodule
$ cc  connobject
$ library/insert mod_python_lib  connobject
$ cc  mod_python
$ cc  requestobject
$ library/insert mod_python_lib  requestobject
$ cc  serverobject
$ library/insert mod_python_lib  serverobject
$ cc  tableobject
$ library/insert mod_python_lib  tableobject
$ cc  util
$ library/insert mod_python_lib  util
$!   mod_python
$ link/share/sysexe mod_python,sys$input/opt
SYMBOL_VECTOR=(PYTHON_MODULE=DATA)
mod_python_lib/lib
apache$httpd_shr/share
dka100:[python.python-1_5_2.vms.o_alpha]python_d00/lib
dka100:[python.python-1_5_2.vms.o_alpha]modules_d00/lib
dka100:[python.python-1_5_2.vms.o_alpha]vms_macro_d00/lib
dka100:[python.python-1_5_2.vms.o_alpha]objects_d00/lib
dka100:[python.python-1_5_2.vms.o_alpha]parser_d00/lib
dka100:[python.python-1_5_2.vms.o_alpha]vms_d00/lib
dka100:[python.python-1_5_2.vms.o_alpha]modules_d00/lib
dka100:[python.python-1_5_2.vms.o_alpha]vms_macro_d00/lib
dka100:[python.python-1_5_2.vms.o_alpha]vms_d00/lib
case_sensitive=no
$!
$ exit

\end{verbatim}