You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rob Bloodgood <ro...@exitexchange.com> on 2006/06/29 02:48:32 UTC

mod_perl[12] + DBD::Oracle under Debian

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

Re: mod_perl[12] + DBD::Oracle under Debian

Posted by Rob Bloodgood <ro...@exitexchange.com>.
Philip M. Gollucci wrote:
>> PerlSetEnv ORACLE_HOME /usr/local/instantclient_10_2
>> PerlRequire startup.pl
> You might also look at PerlPassEnv.

Except for the fact that the whole reason I had the problem was that the
Debian startup script for apache *clears* the environment.

And I quote:

"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}."

L8r,
Rob

Re: mod_perl[12] + DBD::Oracle under Debian

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
> PerlSetEnv ORACLE_HOME /usr/local/instantclient_10_2
> PerlRequire startup.pl
You might also look at PerlPassEnv.


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."