DBCGI
[ about ]
[ download ]
[ how to]
[ support ]
[ todo ]
[ warning! ]
I am a sysadmin for a local police dept. and maintain a great
number of databases. Most of these are small and have only a few
fields, but need to be updated regularly and by many different people.
I usually ended up having to write a cgi script so that everyone could
access it online, but it became tiresome to keep updating the script as
the database changed or bugs in my script came out. So I created a perl
script that did this but read in all it's configuration from a text
file instead of having it hard coded into the cgi script. That way, if
anything changed, I could just update the config file. As I started
adding features and the program started rounding out, I decided to
release it so everyone could use it, as it's pretty handy.
latest
version
sample
config (well commented)
This documentation is very incomplete. I am just starting this
project and plan on writing better docs when I have a chance, but for
now, this should get you started.
This howto assumes that your mysql and apache servers are
installed, configured, and set up correctly on your system, and that
you know the location of your cgi-bin (usually /var/www/cgi-bin
or /usr/lib/cgi-bin). You must also
have a user created in mysql with permissions to the database you want
to use. If you do not plan on requiring a login to use db.cgi,
make sure that the apache user has access to your database as well
(usually this can be accomplished by adding apache@%
(ODBC@% for IIS users) to mysql and giving it permission to your
database). Also, remember to rename db.cgi-version
to db.cgi.
The following steps should give you a working setup:
- Use the sample config above (under download) to create your
config. The file is well commented and should be easy to set
up.
- Create a folder within your cgi-bin to house your config file
and db.cgi.
- Make sure that the first line of db.cgi points to your copy of
perl (usually /usr/bin/perl, so the first
line should be fine).
- Copy both the config file (must be named config) and
db.cgi into the directory you just created.
- As root (or any other user with permission to change permissions
on files in your cgi-bin), cd into the directory you just created and
run:
chmod a+x db.cgi
- Assuming your config file is set up correctly, everything should
work if you just point your browser to db.cgi (for example, if you put
your files in /path/to/cgi-bin/mydb, then
point your browser to http://localhost/cgi-bin/mydb/db.cgi.
- Windows users: if
you have Perl installed and
configured in IIS, you will need to add a binding for .cgi extensions
(if you installed ActivePerl, there should already be a binding for
.pl, so simply make an identical one for .cgi files). You can
edit your bindings from within the IIS Manager snap in (in
Administrative Tools). Right click on your default website on the
left panel, and choose properties. Then go to the Home Directory
tab (no idea why MS decided to put script bindings in the Home
Directory tab) and click the Configuration button. There will be
a list of bindings (i.e. file extensions with the commands used to
execute them). Click Add. Under extensions, put .cgi. Under executable, put C:\Perl\bin\perl.exe
"%s" %s, replacing the path to the perl
executable with the correct path to yours (c:\perl\bin\per.exe
is the
default installation path for ActivePerl). You will also have to
edit the db.cgi file some to make it work in Windows (at least my
experience has shown this). Actually, you only really need to
delete that first line (#!/usr/bin/perl -T).
Just open db.cgi in
notepad or whatever text editor you want and delete that first
line. The rest should work just fine in Windows (I think).
Visit the forums
to post any questions, comments, or problems.
- Create a script to help write the config file
- Fix rollover highlighting so it works in other browsers (note:
done for all browsers but konqueror as of 0.3 release)
- Clean up code with css (note: started work on this in release
0.3)
- Add code to save searches to config file
- Add code to automatically guess the field type instead of having
it in the config file (note: started this in 0.3 - need to work
around html links since there is no equiv. type in mysql)
This script could blow up your computer, set your house on fire,
nuke your database, steal your kids and kill your cat. It is in the
early stages of development and I make no guarantees of its fitness for
any purpose. I make no promises that it will work at all. Use this
program at your own risk!