apache/mod_fastcgi - problem with DBI::DBRC

C

Carl Youngblood

I'm trying to use Daniel Berger's handy database connection abstraction
layer called DBI::DBRC. One of its requirements is the the user that
the calling script is run under must have exclusive access to the DB
connection/password file. This file must be in the user's home
directory. However, my scripts are running as the apache user, which
happens to be called apache on default red hat 9 installations, which
I'm running on. Apache's home dir is in /var/www on RH9. DBRC is
looking for this directory in ENV['HOME'], but this environment variable
is not set when I run my ruby scripts under Apache/mod_fastcgi.

Fine, I thought, I'll just add a directive to my Apache conf to set the
environment right (SetEnv, to be precise). However, that didn't seem to
change anything. I suspect it is because mod_fastcgi runs in a slightly
different environment than regular Apache. Don't know. Anyway, two
kludgey ways of knowing where to save the DBRC file that I can think of are:
- Calling `echo ~` still works. I could add this to dbrc.rb. But
spawning a shell command seems kind of gross for this.
- Or just hard coding it in dbrc.rb, which seems equally gross, and also
the home directory may be different on the server that I deploy this
app on.

Does anybody have an idea of how I can get my ruby/fastcgi scripts to
see regular environment vars?

Thanks,
Carl
 
C

Carl Youngblood

I figured it out. I just needed to look at the cgi environment table.
ENV isn't defined directly in cgi scripts, but of course, the cgi class
holds the environment.

Carl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,701
Latest member
XavierQ83

Latest Threads

Top