So, this problem just took 2 days away from me:

I'm moving a site we have running on an *old* RedHat box to a new Debian
 sarge box.  Which means, of course, I have to make sure all of the
pieces are working.  A critical piece is, of course, the Database
driver, which in my case is Oracle.  Our DB backend is Oracle 8i.  The
previous setup used the Oracle 8i client for linux, which takes about
450MB of space, its own user, and 2 hours to install into a massive tree
of folders and files.

On the new box, Oracle's Instant Client 10g was available, and only
takes about 100MB (which I could have reduced if I went with ClientLite,
but whatever), 3 subfolders, and 5 minutes to install (it essentially
consists of unzipping 3 zip files).

Well, now THAT was done, so I built DBD::Oracle, and got it working
without any trouble.

Now it was time for mod_perl.  And whaddaya know? It's segfault city.
Troubleshooting narrowed it down to: DBI->connect($dsn, $user, $pass);

After much experimenting and gdb'ing and strace'ing and websearching,
the fix is so simple, it's sad.

On Debian, the apache startup script strips the user's environment
before starting the server, and replaces it with:
LANG=C
PATH=/bin:/usr/bin:/usr/local/bin

Which of course removes $ENV{ORACLE_HOME}.  Which causes the underlying
client to segfault when it tries to read the missing environment
variable's value.

Now, I've read more than once around the recommendation to specify the
variable in startup.pl:

BEGIN {
  $ENV{ORACLE_HOME} = '/usr/local/instantclient_10_2';
}

but I took the "higher level" approach and solved it in httpd.conf:

PerlSetEnv ORACLE_HOME /usr/local/instantclient_10_2
PerlRequire startup.pl


I hope this saves somebody an hour (or a day!!!!).

L8r,
Rob

Reply via email to