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
The Oracle.so file and path are go and are set as read/execute for
everyone.
Any ideas?
Woody