Installation

To install WDBI is quite easy - but you need a few other products like an HTTP server, a database system, and an interface between Perl and your database system. (Installing these are actually the hard part).

To make things a little bit more complicated, WDBI supports several different database systems and the exact installation procedures varies slightly depending on which database system you are going to use. The following are therefore generic instructions, that are common for all database systems. Support of the different databases are implemented through a separate database interface module (DBI) for each database system. Specific details, and exceptions are documented in the notes for the individual WDBI DBI's.

Installing Perl

DBI/DBD Support
WDBI uses Perl 5 and the DBI/DBD method of accessing databases from Perl 5. More information about DBI and the individual DBD database modules can be found at:

http://www.hermetica.com/technologia/perl/DBI/index.html.

WDBI is written in Perl, but we need to add some commands to your Perl interpreter to enable it to talk to your database. Fortunately packages with these commands are already available on the Internet. There are DBD::Sybase for Sybase, DBD::Oracle for Oracle, DBD::Informix for Informix, and DBD::mSQL for Mini SQL. These are all extremely useful packages written by different people, with different needs, and different ideas. Unfortunately this means that they all use different commands to do the same things, but the DBI/DBD development community is trying to make the DBD modules as similar as possible.

To allow WDBI to talk to all of them, it uses a separate database interface module for each database system, which is simply an encapsulation of the real database commands. All you have to do is to install Perl - with the commands for your database - and tell WDBI which interface to use. If you do have a set of perl commands to access your database, but no WDBI interface to them, you can write your own. See the appendix on porting to different databases for more details on this.

Before rushing out and grabbing the nearest version of the Perl source, make sure you get the right version. If you want to use mod_perl, you will need Perl 5.004 or better. It's generally best to get the latest release of Perl anyway. There is also the possibility that the DBD module you use will require a particular version of Perl.

When you have downloaded and installed this : Make sure it works ! With the database interface to perl there are normally included a few examples. Try to run these. (This might save you some headaches later ...)

In the following when Perl or the Perl executable is mentioned it is always the version of the Perl executable which includes the database extensions that is meant.

Installing an HTTP Server

To be able to interface to the World Wide Web you need a server that understands Hyper Text Transfer Protocol (HTTP). There are several of these server programs around. I use Apache's HTTP server and have been happy with it, but any server should do, as long as it supports CGI scripts.

CGI is the Common Gateway Interface standard for how HTTP servers communicate with programs on the server. As these programs are started on request from the clients by simply referencing them in a URL like any other HTTP request, the server has to have some way of knowing when to send a file back to the client, and when to execute it and send the result back instead. This is normally done by configuring the server to treat all files in a specified directory as CGI programs.

mod_perl Support
This version of WDBI runs just fine under CGI, but if you need better performance and hate the overhead of using Perl as a CGI language, WDBI has been converted to use the Apache module mod_perl. More information about the Apache Web server and mod_perl is available from:

http://www.apache.org/
http://perl.apache.org/

Put simply, mod_perl allows you to compile a Perl interpreter into the Apache Web server process, so your Perl programs bypass CGI and are interpreted directly by the Web server. Once interpreted, your Perl programs stay in memory to process future requests. This can greatly increase performance and reduce the load on your Web server machine, plus your Perl programs can access the Apache API to do more than any CGI program can do.

To set up Apache to use WDBI via mod_perl, add the following to your srm.conf:

   Alias /perl/  /home/httpd/perl/

   <Location /perl>
   SetHandler  perl-script
   PerlHandler Apache::Registry
   Options +ExecCGI
   </Location>
This assumes you want to use the perl/ directory to store your mod_perl programs. If your mod_perl programs are located somewhere else, use that path instead of the example above.

Installing WDBI ...

Download the WDBI distribution, and un-tar it. This will give you a set of sub-directories that needs to be installed by moving them to the appropriate places.

cgi-bin/
In this directory you will find the wdbi script itself and a script called comments, which you can use to allow your users to send comments back to you from the WDBI forms (and any other HTML page). Move these files to your HTTP servers cgi-bin directory.

bin/
This directory contains several versions of the mkfdf script, one for each database system. See the notes on the WDBI DBI for your database system on which script to use. Rename this script to mkfdf. You need to modify the first line of the script to point to your perl executable. Then move the mkfdf script to a directory in your PATH - or modify your PATH to point to this directory.

conf/
This directory contains configuration files for WDBI - only the user-id of the HTTP server process needs read access to these. (- and your database password will be in one of these files, so make sure you protect them adequately !) I suggest to move them to ~http/wdbi/ (if http is the user running the HTTP server).

contrib/
This directory contains user-contributed tutorials to help you get started with WDBI.

html_docs/
Move these files to a directory in your WWW tree. (For example /wdbi/ in the document root directory.) The HTML files in this directory are the online documentation for WDBI (which you are reading now to get this information :).

mark_lines/
This directory contains a program for adding line numbers to the WDBI program. If you make changes to the WDBI executable, run the mark_lines program in this directory to renumber the marked lines in WDBI. This is essential to get correct debugging information and line numbers in Perl error messages.

sample_fdf/
This directory contains a collection of sample FDFs to show you how to use some of the advanced capabilities of WDBI. Eventually, a complete database and tutorials based on these examples will be included with the WDBI distribution.

mysql_admin/
This directory contains the necessary FDFs to enable you to manage the MySQL user, db, and host tables with WDBI.

Note:You will need to create two more directories. One is needed to keep the FDF files. This directory does not have to be in the WWW tree, but it should be readable by the HTTP process. Once you create the fdf directory, set the $FORMDIR variable in the wdbi.conf file equal to that path.

The other directory for you to create is needed for the WDBI Web page counters, if you decide to use them. Each Web page with a counter needs a file to hold the count of visitors. The path to this file is specified in the VISITOR_COUNT_FILE form variable. You can scatter your counter files all over the hard drive if you want to, but it's a good idea to keep them in one place for neatness' sake.

Because the wdbi script is started by the HTTP server, and we have little control over how it is started, and with what environment, you have to edit two lines of the wdbi script:

    #!/usr/local/bin/perl 

If you are running WDBI under CGI, change the first line to point to your Perl interpreter that you installed earlier. If you are running under mod_perl, you can delete the first line altogether.

Next, locate the $CONFIG_DIR variable and set it to the directory where you installed the file wdbi.conf, detailed in the following section. Also, make sure that wdbi is executable

    chmod +x wdbi.cgi

Now update the configuration file.

Configuring WDBI

To configure WDBI to your local environment and preferences you have to edit the configuration parameters at the top of the wdbi.conf file in the conf/ directory. All of these variables must exist because of changes made to run under mod_perl, so do not remove the ones you don't use. Otherwise you will get errors about undeclared variables.

$WDBI
The path used by the Web server to locate where you've put the WDBI program. Usually, $ENV{'SCRIPT_NAME'} can be used with no problems, but if you have a strange server, you may need to add your path manually. It's a good idea to do it just in case.

$FORMDIR
This is the directory where the form definition files are located. This directory doesn't need to be in the WWW document tree, but it should be readable by the user-id of the HTTP server. (This applies to all files used by WDBI!)

$MAIN_MENU
This should be set to a URL pointing to the main menu ("homepage") for your WDBI pages with links to all the query forms that you create. This will be used for the 'Home' button in the WDBI screens. If you don't like this, simply remove the definition of $MAIN_MENU.

If you prefer to set a different Home Page for an FDF, you can now override $MAIN_MENU in the FDF. See the Form Definition File Syntax page for more details.

$WDBI_HTML
Base URL to the directory where you installed the files in html/

$IMAGEDIR
Base URL to the directory where the GIF buttons (html/*_btn.gif) are installed. (Normally = $WDBI_HTML)

$HELP_BUTTON

Path to the image to use as the help button.

$HOME_BUTTON

Path to the image to use as the home button.

$QUERY_BUTTON

Path to the image to use as the query button.

$QUERY_HELP
This should be the URL for the html/wdbi_query_help.html file. (Normally = $WDBI_HTML/wdbi_query_help.html ).

$USER
The database user to use for queries. Some databases require this, others do not. If yours does not, leave it blank.

$PSWD
The password for the database user. Some databases require this, others do not. If yours does not, leave it blank. (Make sure your Web server does not allow program files to be read by anybody who shouldn't! If a hacker gets the username and password, he/she might wreck your database!)

$SERVER
The database server machine name. Depending on what database system you are using, you might not need this and/or the $user and $pswd parameters. In that case simply set them to the empty string (""), but keep them defined.

$DBI_FILE
This is the name of the DBI (DataBase Interface) file. This file defines the interface between WDBI and the database commands in your Perl interpreter. For example a file called 'msql_dbi.pl' is supplied with WDBI, which is the interface to the DBD::mSQL Mini SQL commands. See the appendix on the database interface to your database system, to see what DBI file to use.

$MAXROWCOUNT
Maximum allowed value for $ROWCOUNT. (The user can't exceed this)

$ROWCOUNT
Maximum number of rows returned by a query. (The user has the option to change this )

@IP_IGNORE

A list of IP addresses for the Web page counter to ignore. This allows you to ignore the WDBI administrator or anyone else that you don't want counted so the counter gives a more accurate count of Web page visitors. For example :
    @IP_IGNORE     = qw(123.123.123.123 321.321.321.321);

$SECURE_WDBI
The path to a password protected directory and copy or symlink to WDBI. If a user has access to WDBI through this path, they can perform update and delete actions. If you don't care about security, just set this to the standard path to WDBI and update and delete will work fine for everyone. Just don't be upset when a Web hacker whacks your database.

$HELPTEXT
This is a standard text that is displayed when an error occurs. You might want to change the contact person etc.

Copyright © 1996-98 Bo Frese Rasmussen and Jeff Rowe