[EMAIL PROTECTED] ("James H. McCullars") writes:

> Hi, I have successfully installed the Oracle instant client, DBI-1.602
> and DBD-Oracle 1.20 and can connect to a database on a remote host,
> but only if I set LD_LIBRARY_PATH to the directory where the instant
> client is installed.  This is fine, but I need to do this from a CGI
> script, and setting the environment there does not work.  I know that
> there is a way to do this in Apache using a SetEnv statement, but I
> would prefer not to do that.  The problem is, the library should be
> found.  The message that is being logged is this:

LD_LIBRARY_PATH on Solaris is already set within the Perl interpreter
when the particular script with DBD::Oracle driver is run. The following
hack works for me when I start cron job or fastcgi script.
Environment is set anew by exec. (This was described in detail at
perlmonks.)

BEGIN {
  unless ($ENV{BEGIN_BLOCK}) {
    $ENV{ORACLE_HOME}     = '/opt/instantclient_10_2';
    $ENV{LD_LIBRARY_PATH} = '/opt/instantclient_10_2';
    $ENV{BEGIN_BLOCK}     = 1;
    exec 'env',$0,@ARGV;
  }
}

-- 
Radek

Reply via email to