Hello!
I just startet learning mod_perl and apache. I use the current version of
mod_perl 1 and apache 1.3. Perl itself has version 6.5.1.
My aim ist to set some environment variables visible to all apache/perl
children (as far as I unsterstand there is one perl instance for each apache
child), but my testapplication does sometimes see my environment settings and
sometimes not. It changes if I press the refresh button of the browser.
According to mod_perl Developerls Cookbook I createt a script called
envteststartup.pl:
1 #!/usr/bin/env perl
2
3 BEGIN{
4 $ENV{ORACLE_HOME}="/opt/oracle/product/9.2.0";
5 $ENV{ORACLE_SID}="i001";
6 $ENV{ORACLE_TERM}="xterm";
7 $ENV{NLS_LANG}="AMERICAN_AMERICA.WE8ISO8859P1";
8
$ENV{ORA_NLS33}="/opt/oracle/product/9.2.0/ocommon/nls/admin/data";
9 $ENV{NLS_TIMESTAMP_FORMAT}="YYYY-MM-DD HH24:MI:SS.FF";
10 $ENV{NLS_TIMESTAMP_TZ_FORMAT}="YYYY-MM-DD HH24:MI:SS.FF TZR";
11 $ENV{NLS_DATE_FORMAT}="YYYY-MM-DD";
12 $ENV{NLS_NUMERIC_CHARACTERS}=",.";
13 $ENV{TNS_ADMIN}="/opt/oracle/product/9.2.0/network/admin";
14
15 $ENV{INFORMIXDIR}="/opt/informix";
16 $ENV{INFORMIXSERVER}="onltuxtcp";
17 $ENV{DBDATE}="Y4MD-";
18 $ENV{DBCENTURY}="C";
19
20 $ENV{BETLOGDIR}="/usr/local/apache/logs";
21 $ENV{BETYUCDB}="yucatan_test1";
22 $ENV{BETYUCDBTYP}="informix";
23 $ENV{BETLOGIN}="login";
24
25 $ENV{SESSIONDIR}="/usr/local/apache/sessions";
26 $ENV{SESSIONLOCKDIR}="/usr/local/apache/sessions/lock";
27 }
28
29 use lib qw(/usr/local/apache/modperlappl);
30 use lib qw(/usr/local/apache);
31
32 use strict;
33 use warnings;
34 use Apache::DBI;
35 use DBI;
36 use Apache::Session;
37 use Apache::Session::File;
38 use Apache::Request;
39 use Apache::URI;
40 use Apache::Log;
41
42 use envtest::handler;
43
44 1;
My http.conf has the following mod_perl entries:
338 PerlRequire conf/envteststartup.pl
339
340 Alias /envtest/ /usr/local/apache/modperlappl/envtest/
341 <Location /envtest/>
342 SetHandler perl-script
343 PerlHandler envtest::handler
344 </Location>
My testapplication is as simple as can be:
1 package envtest::handler;
2
3 sub handler {
4 my $r=Apache::Request->instance(shift());
5
6 $r->send_http_header('text/plain');
7
8 print "Environment:\n";
9
10 while ( my ( $key, $value ) = each %ENV ) {
11 print "$key: $value\n";
12 }
13
14 }
15
16 1;
I assume not all perl instances get my environment settings but where is the
error causing me headache?
Regards,
Bernhard Donaubauer