On Oct 21, 2013, at 1:11 PM, Charlie Smith <smit...@ldschurch.org> wrote:

> Try setting perl env inside apache config.
> 
> Example:
> 
> SetEnv PERL5LIB "/usr/lib/5.10.0: /usr/lib/additionalPerlInstallArea"
> 
> 
> You also should have 
> 
> LoadModule perl_module modules/mod_perl.so

It's there in perl.conf which is being run.

> 
> 
> grep for mod_perl in the Apache error_log file?  you'll see line indicating 
> that mod_perl resuming normal operations.

It's there:

Mon Oct 21 13:21:21 2013] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 
mod_ssl/2.2.15 OpenSSL/1.0.0-fips mod_perl/2.0.4 Perl/v5.10.1 configured -- 
resuming normal operations

also the mod_perl version and API are in %ENV:

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

> 
> Try also
> PerlResponseHandler ModPerl::RegistryPrefork

I get the same error.

> 
> Could also try putting in a ScriptAlias directive in httpd.conf for where you 
> perl scripts are.

If I do that, I get the error:

[root@merthiolate catcard]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: [Mon Oct 21 10:43:21 2013] [warn] The ScriptAlias directive in 
/etc/httpd/conf/httpd.conf at line 593 will probably never match because it 
overlaps an earlier Alias.
                                                           [  OK  ]

> 
> Make sure your perl dir is correct.  There may be some aliases etc. needed 
> from /usr/lib/localperl to /usr/lib/perl for example.

Perl is working just fine, if I don't use DBI in the script no errors happen.

> 
> 64 bit perl?
> 

Yes, 64-bit everything.

The script works if I comment out the mod_perl handler, uncomment the 
ScriptAlias line and restart Apache, so it HAS to be with the mod_perl handler 
directives.


> 
> -----Original Message-----
> From: Bruce Johnson [mailto:john...@pharmacy.arizona.edu] 
> Sent: Monday, October 21, 2013 1:46 PM
> To: Fred Moyer
> Cc: mod_perl list
> Subject: Re: Problem with mod_perl and DBI/DBD::Oracle LD_LIBRARY_PATH is not 
> being recognized?
> 
> Right where it's supposed to:
> 
> /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so
> 
> Again, if this was missing or the build was broken, it wouldn't work on the 
> command line or as a CGI script, either.
> 
> This is what's making me go mad...I can't find anything wrong.
> 
> 
> %ENV is right
> %INC is right
> 
> httpd.conf and perl.conf are right, as far as I can tell
> 
> 
> I've found one reference to this online that isn't very encouraging:
> 
> <http://stackoverflow.com/questions/17050541/unable-to-use-dbdoracle-from-apache-mod-perl>
> 
> "Never got to the bottom of this problem. Built different version of Apache 
> and ModPerl and tried various combinations of Oracle client until the problem 
> went away. Working combination: Apache/2.2.24 (Unix) mod_perl/2.0.7 
> Perl/v5.10.1"
> 
> Our sysadmin would rather we kept to the CentOS repos for all this to make 
> life easier for managing updates (this is a vm)
> 
> On Oct 21, 2013, at 11:42 AM, Fred Moyer <f...@redhotpenguin.com> wrote:
> 
>> Where does Oracle.so live on your filesystem?
>> 
>> 
>> On Mon, Oct 21, 2013 at 11:37 AM, Bruce Johnson 
>> <john...@pharmacy.arizona.edu> wrote:
>> 
>> On Oct 21, 2013, at 11:20 AM, Fred Moyer <f...@redhotpenguin.com> wrote:
>> 
>>> This is annoying but it happens on 64 bit architectures.
>>> 
>>>> The path is correct, the script works fine on the command line, and if I 
>>>> comment out the handler directives in the perl.conf script, put in a 
>>>> ScriptAlias and process the script as a normal CGI script, it also works.
>>> 
>>> Sounds like some environment variable is not getting passed correctly to 
>>> mod_perl. Maybe dump out %ENV from the command line and see if there are 
>>> additional vars you need to pass?
>> 
>> Nope, good idea but the vars I need are present, even with the modperl 
>> handler in place. The only ones you need for DBD::Oracle to work are 
>> ORACLE_HOME and LD_LIBRARY_PATH
>> 
>> DBD::Oracle was properly compiled, else it wouldn't work on the command 
>> line, either.
>> 
>>> 
>>> I'd dump out %INC from the command line and mod_perl also to make sure that 
>>> you are loading the needed modules. You could try to install DBD::Oracle in 
>>> /usr/lib instead of /usr/local/lib also - my guess is that it's looking for 
>>> the Oracle.so in /usr/local/lib but it is located somewhere else.
>> 
>> With mod_perl there is just one more, /etc/httpd
>> 
>> command line:
>> 
>> 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-> .
>> 
>> server:
>> 
>> 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
>> 
>> 
>>> 
>>> 
>>> On Mon, Oct 21, 2013 at 10:57 AM, Bruce Johnson 
>>> <john...@pharmacy.arizona.edu> wrote:
>>> We've set a Directory directive for some perl scripts, setting a mod_perl 
>>> handler:
>>> 
>>> Alias /card_access /home/allwebfiles/perl/catcard
>>> 
>>> <Directory /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  
>>> </Directory>
>>> 
>>> The %ENV variable is there, if I print the %ENV values:
>>> 
>>> 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
>>> 
>>> But trying to initialize a DBI database connection results in the following 
>>> error:
>>> 
>>> [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
>>> 
>>> Which is precisely the error you get when LD_LIBRARY_PATH is unset or 
>>> incorrect.
>>> 
>>> libocci.so.11.1 is where it's supposed to be.
>>> 
>>> [root@merthiolate catcard]# ls -l /usr/lib/oracle/11.2/client64/lib 
>>> total 185016
>>> -rw-r--r-- 1 root root       368 Sep 17  2011 glogin.sql
>>> lrwxrwxrwx 1 root root        17 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 root        15 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 root    164836 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
>>> -rw-r--r-- 1 root root   2714016 Sep 17  2011 ojdbc6.jar
>>> -rw-r--r-- 1 root root    300666 Sep 17  2011 ottclasses.zip
>>> -rw-r--r-- 1 root root     66779 Sep 17  2011 xstreams.jar
>>> 
>>> The path is correct, the script works fine on the command line, and if I 
>>> comment out the handler directives in the perl.conf script, put in a 
>>> ScriptAlias and process the script as a normal CGI script, it also works.
>>> 
>>> I'm confident the issue doesn't have anything to do with DBI or DBD::Oracle.
>>> 
>>> It ONLY fails when the script is executed as a mod_perl handler.
>>> 
>>> The script itself is very simple; all I do is create a database handle and 
>>> if no error is thrown, print 'It works'.
>>> 
>>> #!/usr/bin/perl
>>> use DBI;
>>> use strict;
>>> 
>>> my $login="xxxxxx";
>>> my $dbpass='xxxxxxxx';
>>> my $dbname="host=xxx.xxx.xxx.xx;sid=xxx";
>>> my $dbh = DBI->connect("dbi:Oracle:$dbname", $login, $dbpass, 
>>> {RaiseError =>1});
>>> 
>>> print "Content-type: text/html\n\n"; print "It Works"; exit;
>>> 
>>> (and this is just a test , any script using DBI fails with this 
>>> error.)
>>> 
>>> What am I missing?
>>> 
>>> --
>>> Bruce Johnson
>>> University of Arizona
>>> College of Pharmacy
>>> Information Technology Group
>>> 
>>> Institutions do not have opinions, merely customs
>>> 
>>> 
>>> 
>> 
>> --
>> Bruce Johnson
>> University of Arizona
>> College of Pharmacy
>> Information Technology Group
>> 
>> Institutions do not have opinions, merely customs
>> 
>> 
>> 
> 
> --
> Bruce Johnson
> University of Arizona
> College of Pharmacy
> Information Technology Group
> 
> Institutions do not have opinions, merely customs
> 
> 
> 
> NOTICE: This email message is for the sole use of the intended recipient(s) 
> and may contain confidential and privileged information. Any unauthorized 
> review, use, disclosure or distribution is prohibited. If you are not the 
> intended recipient, please contact the sender by reply email and destroy all 
> copies of the original message.
> 

-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs


Reply via email to