Re: Error appears in web log but script runs ok on the command line

2013-10-21 Thread Bruce Johnson
Nope, built and run with the same path, same install. I installed the Instant 
Client Basic and Development packages via the rpms, set up the proper 
environment variables, used cpan to install DBI, then DBD::Oracle and both 
built without any errors.

It's absolutely a mod_perl handler thing, I just don't know where the problem 
is. It's acting as though it's ignoring its environment settings, even though a 
perl script run by that handler says the environment is correct.


On Oct 21, 2013, at 2:19 PM, "Furst, Carl"  wrote:

> So did you build DBD::Oracle with that LD_LIBRARY_PATH?
> And against that install?
> 
> Maybe Oracle.so is using LD_LIBRARY_PATH set at build time instead of
> runtime?
> 
> 
> 
> 
> Carl Furst
> 
> 
> 
> 
> 
> On 10/21/13 4:03 PM, "Bruce Johnson"  wrote:
> 
>> 
>> On Oct 20, 2013, at 1:03 PM, Bruce Johnson 
>> wrote:
>> 
>>> Oh it turned out to be even simpler than that, and for once it wasn't
>>> MY fat fingers that fat fingered it this time :-)
>> 
>> Cue the sad trombone, because I was wrong, again.
>> 
>> It turns out the issue seems to have something to do with mod_perl.
>> 
>> It works find from the command line, it works fine when the script is
>> executed as a classic CGI script, it fails when run as a mod_perl handler
>> with an error that indicates that LD_LIBRARY_PATH is wrong or missing.
>> 
>> I can recreate the error in CGI mode by commenting out the server
>> directive 'SetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib'
>> 
>> When I found the errors in the conf file, I didn't know that my co-worker
>> had tried that because he'd read that in some web page somewhere and he
>> was starting to get desperate, because nothing was working.
>> 
>> I have, however managed to isolate the problem, and it's got to do with
>> mod_perl 
>> 
>> I'm chasing this on the mod_perl list, but without much luck and am
>> hoping if anyone else has run into this issue using mod_perl and
>> DBD::Oracle.
>> 
>> We've set a directory to be handled by mod_perl as follows:
>> 
>> Alias /card_access /home/allwebfiles/perl/catcard
>> 
>>   SetHandler perl-script
>>   PerlResponseHandler ModPerl::Registry
>>   PerlOptions +ParseHeaders
>>   Options +ExecCGI
>>   PerlSetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib
>>   PerlSetEnv ORACLE_HOME /usr/lib/oracle/11.2/client64
>> 
>> 
>> With those directives in place, I get the error every time. (I've added
>> ORACLE_SID and TNS_ADMIN to the PerlSetEnv declarations, but it makes no
>> difference.
>> 
>> LD_LIBRARY_PATH is set, this is the contents of %ENV and %INC according
>> to the server, with that mod_perl directive in place:
>> 
>> DOCUMENT_ROOT --> /home/allwebfiles/static
>> GATEWAY_INTERFACE --> CGI/1.1
>> HTTPS --> on
>> HTTP_ACCEPT --> 
>> text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
>> HTTP_ACCEPT_ENCODING --> gzip,deflate,sdch
>> HTTP_ACCEPT_LANGUAGE --> en-US,en;q=0.8
>> HTTP_CONNECTION --> keep-alive
>> HTTP_COOKIE --> __qca=P0-1946018635-1381167733063;
>> SESS360e9fa4a6458358b044501f2b5b21b9=4862153113fc157562a1fc7691eecb36;
>> __utma=219252696.1214622818.1382045504.1382045504.1382045504.1;
>> __utmz=219252696.1382045504.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(no
>> ne); CASAUTHOK=1; COPInt=ghZxjY9mJ74QPBgWE13I8cGha
>> HTTP_HOST --> x.pharmacy.arizona.edu
>> HTTP_USER_AGENT --> Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5)
>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
>> LD_LIBRARY_PATH --> /usr/lib/oracle/11.2/client64/lib
>> MOD_PERL --> mod_perl/2.0.4
>> MOD_PERL_API_VERSION --> 2
>> ORACLE_HOME --> /usr/lib/oracle/11.2/client64
>> PATH --> /sbin:/usr/sbin:/bin:/usr/bin
>> QUERY_STRING --> 
>> REMOTE_ADDR --> 128.196.45.237
>> REMOTE_PORT --> 49295
>> REQUEST_METHOD --> GET
>> REQUEST_URI --> /card_access/envvars.pl
>> SCRIPT_FILENAME --> /home/allwebfiles/perl/catcard/envvars.pl
>> SCRIPT_NAME --> /card_access/envvars.pl
>> SERVER_ADDR --> 150.135.124.49
>> SERVER_ADMIN --> root@localhost
>> SERVER_NAME --> x.pharmacy.arizona.edu
>> SERVER_PORT --> 443
>> SERVER_PROTOCOL --> HTTP/1.1
>> SERVER_SIGNATURE -->
>> Apache/2.2.15 (Red Hat) Server at x.pharmacy.arizona.edu Port 443
>> 
>> SERVER_SOFTWARE --> Apache/2.2.15 (Red Hat)
>> SSL_TLS_SNI --> .pharmacy.arizona.edu
>> INC 
>> INC-> /usr/local/lib64/perl5
>> INC-> /usr/local/share/perl5
>> INC-> /usr/lib64/perl5/vendor_perl
>> INC-> /usr/share/perl5/vendor_perl
>> INC-> /usr/lib64/perl5
>> INC-> /usr/share/perl5
>> INC-> .
>> INC-> /etc/httpd
>> 
>> But attempting to create a database handle results in:
>> 
>> [Mon Oct 21 10:10:37 2013] [error] install_driver(Oracle) failed: Can't
>> load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module
>> DBD::Oracle: libocci.so.11.1: cannot open shared object file: No such
>> file or directory at /usr/lib64/perl5/DynaLoader.pm line 200.\n at (eval
>> 11) line 3\nCompilation failed in require at (eval 11) line 3.\nPerhaps a
>> required shar

Re: Error appears in web log but script runs ok on the command line

2013-10-21 Thread Furst, Carl
So did you build DBD::Oracle with that LD_LIBRARY_PATH?
And against that install?

Maybe Oracle.so is using LD_LIBRARY_PATH set at build time instead of
runtime?



 
Carl Furst





On 10/21/13 4:03 PM, "Bruce Johnson"  wrote:

>
>On Oct 20, 2013, at 1:03 PM, Bruce Johnson 
>wrote:
>
>> Oh it turned out to be even simpler than that, and for once it wasn't
>>MY fat fingers that fat fingered it this time :-)
>
>Cue the sad trombone, because I was wrong, again.
>
>It turns out the issue seems to have something to do with mod_perl.
>
>It works find from the command line, it works fine when the script is
>executed as a classic CGI script, it fails when run as a mod_perl handler
>with an error that indicates that LD_LIBRARY_PATH is wrong or missing.
>
>I can recreate the error in CGI mode by commenting out the server
>directive 'SetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib'
>
>When I found the errors in the conf file, I didn't know that my co-worker
>had tried that because he'd read that in some web page somewhere and he
>was starting to get desperate, because nothing was working.
>
>I have, however managed to isolate the problem, and it's got to do with
>mod_perl 
>
>I'm chasing this on the mod_perl list, but without much luck and am
>hoping if anyone else has run into this issue using mod_perl and
>DBD::Oracle.
>
>We've set a directory to be handled by mod_perl as follows:
>
>Alias /card_access /home/allwebfiles/perl/catcard
>
>SetHandler perl-script
>PerlResponseHandler ModPerl::Registry
>PerlOptions +ParseHeaders
>Options +ExecCGI
>PerlSetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib
>PerlSetEnv ORACLE_HOME /usr/lib/oracle/11.2/client64
>
>
>With those directives in place, I get the error every time. (I've added
>ORACLE_SID and TNS_ADMIN to the PerlSetEnv declarations, but it makes no
>difference.
>
>LD_LIBRARY_PATH is set, this is the contents of %ENV and %INC according
>to the server, with that mod_perl directive in place:
>
>DOCUMENT_ROOT --> /home/allwebfiles/static
>GATEWAY_INTERFACE --> CGI/1.1
>HTTPS --> on
>HTTP_ACCEPT --> 
>text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
>HTTP_ACCEPT_ENCODING --> gzip,deflate,sdch
>HTTP_ACCEPT_LANGUAGE --> en-US,en;q=0.8
>HTTP_CONNECTION --> keep-alive
>HTTP_COOKIE --> __qca=P0-1946018635-1381167733063;
>SESS360e9fa4a6458358b044501f2b5b21b9=4862153113fc157562a1fc7691eecb36;
>__utma=219252696.1214622818.1382045504.1382045504.1382045504.1;
>__utmz=219252696.1382045504.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(no
>ne); CASAUTHOK=1; COPInt=ghZxjY9mJ74QPBgWE13I8cGha
>HTTP_HOST --> x.pharmacy.arizona.edu
>HTTP_USER_AGENT --> Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5)
>AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
>LD_LIBRARY_PATH --> /usr/lib/oracle/11.2/client64/lib
>MOD_PERL --> mod_perl/2.0.4
>MOD_PERL_API_VERSION --> 2
>ORACLE_HOME --> /usr/lib/oracle/11.2/client64
>PATH --> /sbin:/usr/sbin:/bin:/usr/bin
>QUERY_STRING --> 
>REMOTE_ADDR --> 128.196.45.237
>REMOTE_PORT --> 49295
>REQUEST_METHOD --> GET
>REQUEST_URI --> /card_access/envvars.pl
>SCRIPT_FILENAME --> /home/allwebfiles/perl/catcard/envvars.pl
>SCRIPT_NAME --> /card_access/envvars.pl
>SERVER_ADDR --> 150.135.124.49
>SERVER_ADMIN --> root@localhost
>SERVER_NAME --> x.pharmacy.arizona.edu
>SERVER_PORT --> 443
>SERVER_PROTOCOL --> HTTP/1.1
>SERVER_SIGNATURE -->
>Apache/2.2.15 (Red Hat) Server at x.pharmacy.arizona.edu Port 443
>
>SERVER_SOFTWARE --> Apache/2.2.15 (Red Hat)
>SSL_TLS_SNI --> .pharmacy.arizona.edu
>INC 
>INC-> /usr/local/lib64/perl5
>INC-> /usr/local/share/perl5
>INC-> /usr/lib64/perl5/vendor_perl
>INC-> /usr/share/perl5/vendor_perl
>INC-> /usr/lib64/perl5
>INC-> /usr/share/perl5
>INC-> .
>INC-> /etc/httpd
>
>But attempting to create a database handle results in:
>
>[Mon Oct 21 10:10:37 2013] [error] install_driver(Oracle) failed: Can't
>load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module
>DBD::Oracle: libocci.so.11.1: cannot open shared object file: No such
>file or directory at /usr/lib64/perl5/DynaLoader.pm line 200.\n at (eval
>11) line 3\nCompilation failed in require at (eval 11) line 3.\nPerhaps a
>required shared library or dll isn't installed where expected\n at
>/home/allwebfiles/perl/catcard/oratest.pl line 9\n
>
>EVEN THOUGH libocci.so.11.1 is right where it's supposed to be, in
>$LD_LIBRARY_PATH.
>
># cd $LD_LIBRARY_PATH
># pwd
>/usr/lib/oracle/11.2/client64/lib
># ls -al
>total 185024
>drwxr-xr-x 2 root root  4096 May 20 12:07 .
>drwxr-xr-x 5 root root  4096 May 20 14:12 ..
>-rw-r--r-- 1 root root   368 Sep 17  2011 glogin.sql
>lrwxrwxrwx 1 root root17 May 20 12:07 libclntsh.so ->
>libclntsh.so.11.1
>-rw-r--r-- 1 root root  52761218 Sep 17  2011 libclntsh.so.11.1
>-rw-r--r-- 1 root root   7955322 Sep 17  2011 libnnz11.so
>lrwxrwxrwx 1 root root15 May 20 12:07 libocci.so ->
>libocci.so.11.1
>-rw-r--r-- 1 root root   1971762

Re: Error appears in web log but script runs ok on the command line

2013-10-21 Thread Bruce Johnson

On Oct 20, 2013, at 1:03 PM, Bruce Johnson  wrote:

> Oh it turned out to be even simpler than that, and for once it wasn't MY fat 
> fingers that fat fingered it this time :-)

Cue the sad trombone, because I was wrong, again.

It turns out the issue seems to have something to do with mod_perl.

It works find from the command line, it works fine when the script is executed 
as a classic CGI script, it fails when run as a mod_perl handler with an error 
that indicates that LD_LIBRARY_PATH is wrong or missing.

I can recreate the error in CGI mode by commenting out the server directive 
'SetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib' 

When I found the errors in the conf file, I didn't know that my co-worker had 
tried that because he'd read that in some web page somewhere and he was 
starting to get desperate, because nothing was working.

I have, however managed to isolate the problem, and it's got to do with 
mod_perl 

I'm chasing this on the mod_perl list, but without much luck and am hoping if 
anyone else has run into this issue using mod_perl and DBD::Oracle.

We've set a directory to be handled by mod_perl as follows:

Alias /card_access /home/allwebfiles/perl/catcard

SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
PerlSetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib
PerlSetEnv ORACLE_HOME /usr/lib/oracle/11.2/client64


With those directives in place, I get the error every time. (I've added 
ORACLE_SID and TNS_ADMIN to the PerlSetEnv declarations, but it makes no 
difference.

LD_LIBRARY_PATH is set, this is the contents of %ENV and %INC according to the 
server, with that mod_perl directive in place:

DOCUMENT_ROOT --> /home/allwebfiles/static
GATEWAY_INTERFACE --> CGI/1.1
HTTPS --> on
HTTP_ACCEPT --> 
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_ACCEPT_ENCODING --> gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE --> en-US,en;q=0.8
HTTP_CONNECTION --> keep-alive
HTTP_COOKIE --> __qca=P0-1946018635-1381167733063; 
SESS360e9fa4a6458358b044501f2b5b21b9=4862153113fc157562a1fc7691eecb36; 
__utma=219252696.1214622818.1382045504.1382045504.1382045504.1; 
__utmz=219252696.1382045504.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); 
CASAUTHOK=1; COPInt=ghZxjY9mJ74QPBgWE13I8cGha
HTTP_HOST --> x.pharmacy.arizona.edu
HTTP_USER_AGENT --> Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
LD_LIBRARY_PATH --> /usr/lib/oracle/11.2/client64/lib
MOD_PERL --> mod_perl/2.0.4
MOD_PERL_API_VERSION --> 2
ORACLE_HOME --> /usr/lib/oracle/11.2/client64
PATH --> /sbin:/usr/sbin:/bin:/usr/bin
QUERY_STRING --> 
REMOTE_ADDR --> 128.196.45.237
REMOTE_PORT --> 49295
REQUEST_METHOD --> GET
REQUEST_URI --> /card_access/envvars.pl
SCRIPT_FILENAME --> /home/allwebfiles/perl/catcard/envvars.pl
SCRIPT_NAME --> /card_access/envvars.pl
SERVER_ADDR --> 150.135.124.49
SERVER_ADMIN --> root@localhost
SERVER_NAME --> x.pharmacy.arizona.edu
SERVER_PORT --> 443
SERVER_PROTOCOL --> HTTP/1.1
SERVER_SIGNATURE -->
Apache/2.2.15 (Red Hat) Server at x.pharmacy.arizona.edu Port 443

SERVER_SOFTWARE --> Apache/2.2.15 (Red Hat)
SSL_TLS_SNI --> .pharmacy.arizona.edu
INC 
INC-> /usr/local/lib64/perl5
INC-> /usr/local/share/perl5
INC-> /usr/lib64/perl5/vendor_perl
INC-> /usr/share/perl5/vendor_perl
INC-> /usr/lib64/perl5
INC-> /usr/share/perl5
INC-> .
INC-> /etc/httpd

But attempting to create a database handle results in:

[Mon Oct 21 10:10:37 2013] [error] install_driver(Oracle) failed: Can't load 
'/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: 
libocci.so.11.1: cannot open shared object file: No such file or directory at 
/usr/lib64/perl5/DynaLoader.pm line 200.\n at (eval 11) line 3\nCompilation 
failed in require at (eval 11) line 3.\nPerhaps a required shared library or 
dll isn't installed where expected\n at 
/home/allwebfiles/perl/catcard/oratest.pl line 9\n

EVEN THOUGH libocci.so.11.1 is right where it's supposed to be, in 
$LD_LIBRARY_PATH.

# cd $LD_LIBRARY_PATH
# pwd
/usr/lib/oracle/11.2/client64/lib
# ls -al
total 185024
drwxr-xr-x 2 root root  4096 May 20 12:07 .
drwxr-xr-x 5 root root  4096 May 20 14:12 ..
-rw-r--r-- 1 root root   368 Sep 17  2011 glogin.sql
lrwxrwxrwx 1 root root17 May 20 12:07 libclntsh.so -> libclntsh.so.11.1
-rw-r--r-- 1 root root  52761218 Sep 17  2011 libclntsh.so.11.1
-rw-r--r-- 1 root root   7955322 Sep 17  2011 libnnz11.so
lrwxrwxrwx 1 root root15 May 20 12:07 libocci.so -> libocci.so.11.1
-rw-r--r-- 1 root root   1971762 Sep 17  2011 libocci.so.11.1
-rw-r--r-- 1 root root 118408281 Sep 17  2011 libociei.so
-rw-r--r-- 1 root root164836 Sep 17  2011 libocijdbc11.so
-rw-r--r-- 1 root root   1503303 Sep 17  2011 libsqlplusic.so
-rw-r--r-- 1 root root   1477446 Sep 17  2011 libsqlplus.so
-rw-r--r-- 1 root root   2095661 Sep 17  2011 ojdbc5.jar

Re: Error appears in web log but script runs ok on the command line

2013-10-21 Thread Bruce Johnson
Oh it turned out to be even simpler than that, and for once it wasn't MY fat 
fingers that fat fingered it this time :-)

At first, it wasn't working because the SetEnv variable was not set in the 
virtual host  conf files, just in the main httpd.conf .

Then I didn't check closely enough when the person doing the work said he'd 
copied those to the conf where the virtual host definitions were set. 

Working system httpd.conf:

 grep LD_LIB /etc/httpd/conf/httpd.conf 
SetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib

Broken system httpd.conf:

grep LD_LIB /etc/httpd/conf/httpd.conf 
#SetEnv LD_LIBRARY_PATH /usr/lib/oracle/12.1/client64/lib

Broken system ssl.conf:

grep LD_LIB /etc/httpd/conf.d/ssl.conf 
SetEnv LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
SetEnv LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib

Oops. 

Thanks for your help and suggestions, and Carl, who was right all along! 

On Oct 20, 2013, at 5:53 AM, lesleyb  wrote:

> Hi Bruce
> 
> On Fri, Oct 18, 2013 at 07:56:52PM +, Bruce Johnson wrote:
>> First thing I checked, and they're set correctly;
>> 
>>> From %ENV on the broken system:
>> 
>> 
>> ORACLE_HOME --> /usr/lib/oracle/12.1/client64
>> LD_LIBRARY_PATH --> /usr/lib/oracle/12.1/client64/lib
>> 
> but the original error is 
> Can't load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so'
> The error under the web server environment is saying Oracle.so is not in
> /usr/local/lib64/perl5/auto/DBD/Oracle which is where it is looking for it.
> 
> I'm assuming Oracle.so is installed on your system somewhere because the 
> script
> works on the command line but not from within Apache.
> 
> Perhaps check and compare the %ENV in Apache with the command-line %ENV? And
> note Apache is looking for the /usr/local/lib64 directory - not anything in
> /usr/lib or /usr/lib64.
> 
> Kind regards
> 
> Lesley
>> 
>> This is the only thing I can think of that could cause this error. I've 
>> compared permissions, etc with a working server and I see nothing wrong. The 
>> only main difference is that the problem system is running version 12 of the 
>> Instant Client and the working one is running 11.2, but that would cause the 
>> program to fail on the command line as well.
>> 
>> On Oct 18, 2013, at 12:30 PM, "Furst, Carl" 
>> wrote:
>> 
>>> Ld_library_path is getting set in apache configs or wrapper scripts?
>>> 
>>> Have you tried setting
>>> SetEnv LD_LIBRARY_PATH
>>> 
>>> In httpd.conf? 
>>> 
>>> Or have it set when you call apachectl??
>>> 
>>> 
>>> 
>>> Carl Furst
>>> 
>>> 
>>> 
>>> 
>>> On 10/18/13 3:10 PM, "Bruce Johnson"  wrote:
>>> 
 I'm getting the following error on a newly set-up server:
 
 [Fri Oct 18 12:02:06 2013] [error] install_driver(Oracle) failed: Can't
 load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module
 DBD::Oracle: libocci.so.12.1: cannot open shared object file: No such
 file or directory at /usr/lib64/perl5/DynaLoader.pm line 200.\n at (eval
 11) line 3\nCompilation failed in require at (eval 11) line 3.\nPerhaps a
 required shared library or dll isn't installed where expected\n at
 /home/webfiles/apply/perl/oratest.pl line 7\n
 
 
 It's a really simple script that just connects to the database:
 
 #!/usr/bin/perl
 use DBI;
 use strict;
 my $login="xx";
 my $dbpass='xx';
 my $dbname="host=x..x.;sid=xx";
 my $lda = DBI->connect("dbi:Oracle:$dbname", $login, $dbpass, {RaiseError
 =>1});
 print "Content-type: text/html\n\n";
 print "It Works";
 exit;
 
 
 I've confirmed that Apache has the correct LD_LIBRARY_PATH and
 ORACLE_HOME vars set yet whenever we run the script on the web server we
 get the error. 
 
 On the command line it's:
 
 [root@ perl]# perl oratest.pl
 Content-type: text/html
 
 It Works
 
 
 Any ideas?
 
 -- 
 Bruce Johnson
 University of Arizona
 College of Pharmacy
 Information Technology Group
 
 Institutions do not have opinions, merely customs
 
 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> **
>>> 
>>> MLB.com: Where Baseball is Always On
>> 
>> -- 
>> Bruce Johnson
>> University of Arizona
>> College of Pharmacy
>> Information Technology Group
>> 
>> Institutions do not have opinions, merely customs
>> 
>> 

-- 
Bruce Johnson

"Wherever you go, there you are." B. Banzai, PhD