Gossamer Forum
Home : Products : DBMan : Installation :

multiple tables, one db.cgi - how?

Quote Reply
multiple tables, one db.cgi - how?
I'm hoping, based on what I've been reading, that someone can help me.

I'm attempting to set up dbman so that my db.cgi is in a /dbman subdirectory of my cgi-bin directory, along with the .count, .pass, and .log files, and have the .db, .cfg, and html.pl files in a subdirectory of /dbman (There will eventually be multiple sibling subdirectories, each one corresponding to a table).

All permissions appear to be correct (I've got a database in the same directory as db.cgi that works just fine), but I can't seem to figure out how to specify where to look for the .cfg file when passing the db= parameter to db.cgi. Anything I try gives me the old "Error loading required libraries", probably because I'm passing a / after the ?. Is this correct? Is what I'm trying to do possible?

I'm a Perl/Unix neophyte, so dummies-level help is no insult. Thanks...
Quote Reply
Re: multiple tables, one db.cgi - how? In reply to
made sense, and thanks for the prompt reply, but unfortunately didn't seem to help....

the files are live at http://www.thepartnership.org/cgi-bin/dbman/db.cgi, default works fine, as does db=nfcpa, since the nfcpa database is located in the same directory as the db.cgi executable

what doesn't work is db=biz, or db=biz/biz, or db=/biz/biz, with biz being a subdirectory of /dbman, and biz.cfg being the name used for the config file contained therein

help?
Quote Reply
Re: multiple tables, one db.cgi - how? In reply to
Okay, what you need to do is write the physical path to your files for the variables listed at the top of the file in the default.cfg file, with the exception of the $db_dir_url variable, which should point to your "virtual" directory, with http://....

Example:

Code:
$db_dir_url = "http://www.myserver.com/cgi-bin/dbman";

# URL of dbman.
$db_script_url = "/path/to/cgi-bin/dbman/db.cgi";

# Full Path and File name of the database file.
$db_file_name = "/path/to/cgi-bin/dbman/sub-directory/default.db";

# Full path and file name of the counter file.
$db_id_file_name =
"/path/to/cgi-bin/dbman/sub-directory/default.count";

# Full path and file name of the authorization directory.
$auth_dir = "/path/to/cgi-bin/dbman/auth";

# Full path and file name of the password file.
$auth_pw_file = "/path/to/cgi-bin/dbman/sub-directory/default.pass";

# Full path and file name of the log file.
$auth_log_file = "/path/to/cgi-bin/dbman/sub-directory/default.log";

# Full path and file name of the html routines.
require "/path/to/cgi-bin/dbman/sub-directory/html.pl";

Hope this makes sense and helps.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited September 23, 1999).]
Quote Reply
Re: multiple tables, one db.cgi - how? In reply to
I don't know if this would work for you or not, but you might give it a try.

In your URL to your db, use %2F instead of /.

So you would use db=biz%2Fbiz.

The %2F is the urlencoding of the / character. Like I say, I don't know if it will work, but you can give it a shot.

I do have another thought that would take quite a bit of work. But let's try the easy one first. Smile


------------------
JPD





Quote Reply
Re: multiple tables, one db.cgi - how? In reply to
JPD-

It was worth a shot, but no dice, the screen dump I get correctly renders the %2F as a /, so it is being parsed properly, but the error messages I get are the same
Quote Reply
Re: multiple tables, one db.cgi - how? In reply to
Darn! I was afraid of that.

Before you go through all the trouble of changing a lot of stuff, let's see if my other idea is even feasible.

Try adding

&dir=biz

to the URL.

Also, in db.cgi, change

require "$db_setup.cfg";

to
Code:
if ($in{'dir'}) {
require "$in{'dir'}/$db_setup.cfg";
}
else {
require "$db_setup.cfg";
}

See if you get the login form for your database. You won't be able to do anything with it at this point, but you'll be able to see if you can define a directory through the URL. If you can, we'll start working on adjusting all the forms and links to include the dir variable.

Another thought would be to keep the .cfg files in the same directory as dbman, but create directories for the data files. Then Eliot's suggestion will work for you.



------------------
JPD





Quote Reply
Re: multiple tables, one db.cgi - how? In reply to
Hey, hey, I got it to work!!

What I finally had to do was set up the variables as follows:

# URL of the directory dbman resides in. No Trailing Slash Please.
$db_dir_url = "http://www.thepartnership.org/cgi-bin/dbman";
# URL of dbman.
$db_script_url = $db_dir_url . "/db.cgi";
# Full Path and File name of the database file.
$db_file_name = $db_script_path . "/biz/biz.db";
# Full path and file name of the counter file.
$db_id_file_name = $db_script_path . "/nfcpa.count";
# Full path and file name of the authorization directory.
$auth_dir = $db_script_path . "/auth";
# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "/nfcpa.pass";
# Full path and file name of the log file.
$auth_log_file = $db_script_path . "/nfcpa.log";
# Full path and file name of the html routines.
require $db_script_path . "/biz/bizhtm.pl";

and, of course, had to put the biz.cfg file in the root directory with db.cgi. It's not as pretty a solution as being able to put the .cfg file in a subdirectory, but I'd rather do that than have to modify everything else to include references to a "dir" variable, and I'll be cleaning up the root when this finally goes live.

Thanks to both of you for your help, I'm sure I'll need more ;-).
Quote Reply
Re: multiple tables, one db.cgi - how? In reply to
Excellent solution! I really think this is the best compromise. Smile


------------------
JPD