I'm taxing my memory to try to remember how we did this a few
years ago - so take this with a grain of salt.  One thing you
should know if you don't already is there are probably several
ways to fix your problem - this is just one.  In fact Tim
Bunce suggested setting LD_LIBRARY_PATH in the apache
configuration - I don't know how to do that.

I believe at the start of every perl cgi script interfacing
with Oracle we did this:

#!/usr/bin/perl -w

BEGIN {
   export ORACLE_HOME=/path/to/oracle/home
   export ORACLE_SID=abc # substitute your sid for 'abc'
   export LD_LIBRARY_PATH=/blah/blah
}

use strict "subs";
use Apache::DBI;
use DBI;
#etc.
--------------------------------------
and, we did this - in /etc/ld.so.conf, add a line like
this

  /path/to/oracle/home/lib

and then run 'ldconfig'.

That's as much as I can remember - hope it helps.

I'd also try searching on google for something like
'perl dbi oracle'.

-- 
Hardy Merrill
Red Hat, Inc.


Kevin Moore [EMAIL PROTECTED] wrote:
> All:
> 
> Thanks all for your replies. I'm still unable to make this work. Is 
> there a "How To" doc for configuring Apache 2.x to run perl scripts 
> somewhere I can review to find out where my install went bad? I've not 
> found anything out there like this and am floundering. Thanks.
> 
> Kevin
> 
> Tim Bunce wrote:
> 
> >On Thu, Dec 11, 2003 at 08:29:14PM -0800, Kevin Moore wrote:
> > 
> >
> >>>Hi Steve,
> >>>
> >>>I can run the scripts from the command line. The script connects to 
> >>>the database with no questions asked and selects data from tables. I'm 
> >>>pretty sure the problem is with Apache interfacing with Perl/DBI. My 
> >>>problem is knowing what to do to fix this. Should environments such as 
> >>>LD_LIBRARY_PATH be set in the Apache configuration or what?
> >>>     
> >>>
> >
> >Yes.
> >
> >Tim.
> >
> > 
> >
> >>I'm new to 
> >>   
> >>
> >>>this area as you can tell. I'm looking for somebody who has made this 
> >>>work to point me in the right direction. Any pointers are appreciated. 
> >>>Thanks.
> >>>
> >>>Kevin
> >>>     
> >>>
> >>
> >>Steve Baldwin wrote:
> >>
> >>   
> >>
> >>>Did you try executing your Perl CGI script from the command line (as
> >>>opposed to via the web server) ?  None of our CGI scripts set
> >>>LD_LIBRARY_PATH, (although we use Apache 1 not 2).  Could it be a
> >>>permissions thing ?  Did you confirm that the Oracle client library is
> >>>present and accessible ?  If the cgi executes from the command line,
> >>>maybe it's an Apache setup thing rather than a DBI thing.
> >>>
> >>>-----Original Message-----
> >>>From: Kevin Moore [mailto:[EMAIL PROTECTED] 
> >>>Sent: Friday, 12 December 2003 11:12 AM
> >>>To: '[EMAIL PROTECTED]'
> >>>Subject: Apache, Oracle, Perl DBI Problems
> >>>
> >>>
> >>>Gang,
> >>>
> >>>I'm attempting to write a perl script, callable from a URL, that 
> >>>connects me to an Oracle 9i database. I've combed the help pages and 
> >>>think i'm just missing something simple. From what i've read it appears 
> >>>that my LD_LIBRARY_PATH is not being set correctly. I've set the 
> >>>LD_LIBRARY_PATH variable in the perl script and installed the DBI 
> >>>modules. Below is the environment, code snippet, and error message. Any 
> >>>ideas anyone? Completely lost here. - Kevin
> >>>
> >>>Environment:
> >>>
> >>>Red Hat Linux 9.0
> >>>Apache 2.0.40
> >>>Apache-DBI-0.91
> >>>DBD-Oracle-1.14
> >>>DBI-1.35
> >>>
> >>>Code Snippet:
> >>>
> >>>#!/usr/bin/perl -w
> >>>
> >>>use strict "subs";
> >>>use Apache::DBI;
> >>>use DBI;
> >>>use DBD::Oracle;
> >>>use CGI;
> >>>use CGI::Carp qw(fatalsToBrowser);
> >>>use CGI::Cookie;
> >>>#use Apache::Registry;
> >>>
> >>>package CGIBook::Error;
> >>>
> >>>use vars qw( $dbh $CGI $TABLE $q $r @FIELD_NAMES);
> >>>
> >>>my ( $sth, @row );
> >>>
> >>>@FIELD_NAMES = ("uinp_uname", "uinp_fname", "uinp_lname", "uinp_active",
> >>>             "uinp_email", "uinp_passwd", "uinp_signup",
> >>>"last_login",
> >>>             "conf_passwd");
> >>>
> >>>$TABLE = "webusers";
> >>>$ENV{'ORACLE_HOME'} = '/home/oracle/product/9ias';
> >>>#$ENV{'LD_LIBRARY_PATH'} = '/home/oracle/product/9ias/lib';
> >>>$ENV{'TWO_TASK'} = 'webapp'; $ENV{'LD_RUN_PATH'} = 
> >>>"/home/oracle/product/9ias/lib:/home/oracle/product/9ias/r
> >>>dbms/lib";
> >>>
> >>>LD_LIBRARY_PATH = '/home/oracle/product/9ias/lib';
> >>>
> >>># $CGI = new CGI();
> >>>
> >>>### Connect To Database
> >>>
> >>>my $dbh = DBI->connect( "dbi:Oracle:WEBAPP.WORLD", "user", "password" ,
> >>>{
> >>>     PrintError => 0,
> >>>     RaiseError => 0
> >>>     } ) or die "Can't connect To Database: $DBI::errstr\n";
> >>>
> >>>Error message:
> >>>
> >>>[error] [client 192.168.1.3] Premature end of script headers: signup.cgi
> >>>[Thu Dec 11 16:01:14 2003] [error] [client 192.168.1.3] Can't load 
> >>>'/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBD/Oracle/
> >>>Oracle.so' 
> >>>for module DBD::Oracle: libclntsh.so.8.0: cannot open shared object 
> >>>file: No such file or directory at 
> >>>/usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229.
> >>>[Thu Dec 11 16:01:14 2003] [error] [client 192.168.1.3]  at 
> >>>/home/httpd/cgi-bin/signup.cgi line 6
> >>>[Thu Dec 11 16:01:14 2003] [error] [client 192.168.1.3] Compilation 
> >>>failed in require at /home/httpd/cgi-bin/signup.cgi line 6. [Thu Dec 11
> >>>16:01:14 2003] [error] [client 192.168.1.3] BEGIN 
> >>>failed--compilation aborted at /home/httpd/cgi-bin/signup.cgi line 6.

Reply via email to