Using DBI from within Apache

H

Hog Spog

Hello

Please help. I have loaded the latest DBI and DBD::Oracle modules.
These have compiled and installed successfully and I have a program
that logs into my database and works fine from the command line. This
is as long as I have the environment variables ORACLE_HOME and
LD_LIBRARY_PATH set and exported. However I cannot call the program
as a CGI program from my Apache server. My CGI directory is properly
configured in that I can call other CGI programs with no problem. I
have stopped the httpd daemon and started it again with those
environment variables set and exported but to no avail.
I get the following error in the error_log.

install_driver(Oracle) failed: Can't load
'/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBD/Oracle/Oracle.so'
for module DBD:Oracle: libclntsh.so.8.0: cannot load shared object
file: No such file or directory at
/usr/lib/perl5/5.6.0/i386-linus/Dynaloader.pm line 200. at (eval 1)
line 3

The shared library libclntsh.so.8.0 exists in the directory
/home/oracle/product/8.1.6/lib which is what the LD_LIBRARY_PATH is
set to. My question is really how do I get the LD_LIBRARY_PATH set
when my CGI programs run?

Thanks in advance

Hog Spog
 
B

Brian McCauley

(e-mail address removed) (Hog Spog) writes a lot of rambing thoughts, then
finally sorts himself out and realised that:
My question is really how do I get the LD_LIBRARY_PATH set
when my CGI programs run?

So having got that far you should have gone back an changed the
"Newsgroups" line to point to some newsgroups where CGI and web
server (and in particular Apache) conifuration are discussed.

This newsgroup is about Perl, and as you yourself point out your
question is not about Perl.

OT Hint: The Apache conifuration directives that maniputate the
environment variables tend to have "Env" somewhere in their names.

--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
OA
 
G

Graham Wood

Brian said:
(e-mail address removed) (Hog Spog) writes a lot of rambing thoughts, then
finally sorts himself out and realised that:


So having got that far you should have gone back an changed the
"Newsgroups" line to point to some newsgroups where CGI and web
server (and in particular Apache) conifuration are discussed.

This newsgroup is about Perl, and as you yourself point out your
question is not about Perl.

OT Hint: The Apache conifuration directives that maniputate the
environment variables tend to have "Env" somewhere in their names.

Wouldn't it be possible to set your LD_LIBRARY_PATH and your ORACLE_HOME
in the perl script rather than relying on the environment your "nobody"
apache user gets?
$ENV{LD_LIBRARY_PATH}="/usr/lib.....";
$ENV{ORACLE_HOME}="/oracle/ora81...";


Graham
 
T

Tony

Hello

Please help. I have loaded the latest DBI and DBD::Oracle modules.
These have compiled and installed successfully and I have a program
that logs into my database and works fine from the command line. This
is as long as I have the environment variables ORACLE_HOME and
LD_LIBRARY_PATH set and exported. However I cannot call the program
as a CGI program from my Apache server. My CGI directory is properly
configured in that I can call other CGI programs with no problem. I
have stopped the httpd daemon and started it again with those
environment variables set and exported but to no avail.
I get the following error in the error_log.

install_driver(Oracle) failed: Can't load
'/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBD/Oracle/Oracle.so'
for module DBD:Oracle: libclntsh.so.8.0: cannot load shared object
file: No such file or directory at
/usr/lib/perl5/5.6.0/i386-linus/Dynaloader.pm line 200. at (eval 1)
line 3

The shared library libclntsh.so.8.0 exists in the directory
/home/oracle/product/8.1.6/lib which is what the LD_LIBRARY_PATH is
set to. My question is really how do I get the LD_LIBRARY_PATH set
when my CGI programs run?

Thanks in advance

Hog Spog


Hi,
I had a similar sort of thing, perl worked from the command line but
not in a cgi script. In the end I found it to be permissions, what
ever your web server runs as it will probably need read and execute
permissions on all libs it is trying to use.

Hope this helps

Tony
 
H

Helgi Briem

This is a multi-part message in MIME format.

Tell your newsreader program to stop doing that.
Usenet is a text-only medium. Turn off that
vcard option.
 
H

Hog Spog

Apologies for posting on the wrong board but if you are interested I have solved
the problem. I used the SetEnv parameters in the httpd.conf file for Apache
which sorted me out. I tried the $ENV stuff but the perl script was failing on
compilation so it didn't work. Thanks for your help.

Cheers

Hog Spog
 

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

No members online now.

Forum statistics

Threads
474,129
Messages
2,570,770
Members
47,329
Latest member
FidelRauch

Latest Threads

Top