See below...

Woody McKay [[EMAIL PROTECTED]] wrote:
> Hello all,
> 
> I'm using Apache 1.3.6 on Solaris 8, Perl 5.6.1, the latest DBI and
> DBD:Oracle, and Oracle 8.1.7 database.  I can connect to the Oracle
> database and retrieve a result set from the Solaris command line with
> 'Perl test.pl' (code is below).  But I can not from a web page although
> plain CGI/Perl works fine.  I thought what I needed was to set the
> Oracle_Home environment variable for the Apache 'nobody' user. I did
> this with SetEnv in the httpd.conf file but it didn't help. 
> 
> #!/usr/bin/perl
> use DBI;
> use DBD::Oracle;
> print "Content-type: text/html\n\n";
> my $dbh = DBI->connect('dbi:Oracle:devl3', 'dmsuser', 'dmsuser');
> unless (defined $dbh) {
>         print "Cannot connect to server: $DBI::errstr\n";
>         die;
> }
> my $sth = $dbh->prepare('select test_key, test_value from test_table');
> $sth->execute;
> my($test_key, $test_value);
> $sth->bind_columns(undef, \$test_key, \$test_value);
> print '<table border="1">';
> while($sth->fetch()) {
>         print '<tr><td>', $test_key, '</td><td>', $test_value,
> '</td></tr>';
> }
> 
> 
> It seems that the 'use DBD::Oracle' line in test.pl is causing a problem
> when executed through the Apache server.  
> 
> The error.log shows:
> 
> Can't load
> '/opt/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBD/Oracle/Oracle.so'
> for module DBD::Oracle: ld.so.1: /usr/bin/perl: 
> fatal: /export/home/oracle/OraHome1/lib/libclntsh.so.8.0: Permission
> denied at /opt/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206.
>  at /usr/apache/cgi-bin/test.pl line 4
> Compilation failed in require at /usr/apache/cgi-bin/test.pl line 4.
> BEGIN failed--compilation aborted at /usr/apache/cgi-bin/test.pl line 4.
> [Tue Oct 23 14:25:25 2001] [error] [client 10.0.1.52] Premature end of
> script headers: /usr/apache/cgi-bin/test.pl

Perl has a problem finding the oracle libraries - I fixed this
with help from the list to do this:

  * add $ORACLE_HOME/lib to your /etc/ld.so.conf
      (substitute your oracle home for $ORACLE_HOME)
  * run(as root?) ldconfig

This fixed my problem - hopefully it will fix yours.

HTH.

-- 
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com

Reply via email to