Re: Problem with mod_perl and DBI/DBD::Oracle LD_LIBRARY_PATH is not being recognized?

Torsten Förtsch <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On 21/10/13 19:57, Bruce Johnson 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
> 
I haven't read the whole thread. So, I apologize if I state what
somebody else has already explained.

To me the problem seems to be %ENV being tied to $r->subprocess_env. So,
neither PerlSetEnv nor SetEnv actually change the current process'
environment. The reason for that the environment is a global resource in
a potentially multi-threaded process.

If you don't need these variables set differently for different requests
you can perhaps set them before starting httpd. Or you can set them
perhaps in a <perl> section or similar.

If you need them differently make sure not to run a threaded MPM. Then
there is a module named Env::C or C::Env on CPAN that can help to modify
the real process environment.

Torsten
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.