Home
Home
Gallery
Musings

Apache DBI mod_perl EdLUG demo

Intro

In June 2003 I prepared and delivered a demo of setting up PostgreSQL, and Apache so that they could communicate SQL via DBI using mod_perl. This was achieved by the use of two make files. One for building PostgreSQL and the other for building Apache with mod_perl.

Then a example mod_perl script was used to demonstrate the connection and the caching properties that make this kind of set up so powerful and efficient.

I would not suggest playing with this unless your comfortable with Makefile syntax. You could leave your system broken or in an insecure state. I accept no responsibility if you damage you system or if your systems are damaged or compromised as a result of using these files and instructions.

PostgreSQL

This is the PostgreSQL makefile. Download it and change its name to Makefile when run it'll ask you for the root password and then it will install PostgreSQL in /home/postgres. So make sure you've got a user called postgres on your system.

It goes without saying (but I'm going to anyway) that you should only play about with these makefiles on a scratch box or inside a test UML session. Even then both the makefile for PostgreSQL or Apache may need tweaking when the file paths don't match up with what you have on your box.

You need to have Perl and OpenSSL installed to compile this Postgres with this makefile. The make finishes with a su to the postgres user and it initializing and starting the database instance on port 10123

Apache and mod_perl

We assume you have installed a working DBI and DBD::Pg

Download the Apache makefile, rename it to Makefile and run the make. It'll down load OpenSSL, zlib, mod_perl and Apache and build them for you. If the file paths aren't appropriate for your system, just edit the makefile.

The test mod_perl script is here rename it perl_test.pl, and a example httpd.conf is here, rename it httpd.conf.bak. Both might need a little altering to suit you own set up. My demo was performed on my laptop and it was not designed with portability in mind, it was after all just a demo.

So copy perl_test.pl to the right place, fire up Apache and you should now have a mod_perl DBI connection to your database.


Last updated Jul 19, 2003
$Id: index.html,v 1.12 2003/12/08 11:22:37 faye Exp $
Valid HTML 4.0!
Recheck page

HTML,Javatm,JavaScript,CGI,Perl and PHP designed and written by Morpheux. All material on this site is GFDL'd unless stated otherwise. Copyright (c) 2001 Faye Gibbins. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
GNU Free Documentation License
Morpheux is a Trade Mark
Mail: , remove NOSPAM