Hello Fredo Sartori, Thursday, August 15, 2002, 1:44:34 PM, you wrote:
I mabe wrong, but what about to move code to setup ENV out from BEGIN block ? I wrote simple test below: # Test.pm package Test; use Apache::Constants qw ( :common ); BEGIN { $ENV{FOO1} = 'BAR1'; $ENV{FOO2} = 'BAR2'; } sub handler { my $r = shift; $r->print("Content-Type: text/plain\n\n"); print "FOO1=$ENV{FOO1}, FOO2=$ENV{FOO2}\n"; return OK; } 1; __END__ # httpd.conf SetEnv FOO1 QQ1 SetEnv FOO2 QQ2 <Location /test> SetHandler perl-script PerlHandler Test PerlSendHeader On </Location> One the first request of the fresh apache, I got: FOO1=BAR1, FOO2=BAR2 On all subsequent requests: FOO1=QQ1, FOO2=QQ2 I thing this is because mod_perl reset ENV hash on each request, but I'm not sure. And I'm on Apache/1.3.23 (Unix) mod_perl/1.26. Not on apache2. Did you confirm such behaviour of MP2 ? Does not find any mention which confirm this in the guide :( FS> Hi, FS> I have problems connecting to an Oracle-DB through apache2. A test FS> script, that works fine when run directly from the shell, fails to FS> connect to the Orcacle DB, when run through apache. As far as I can see, FS> the SID is not passed to the DB server. FS> ..................................... FS> The foolowing message is found in the error log: FS> [Thu Aug 15 09:25:46 2002] [error] 27824: ModPerl::Registry: `DBI->>connect(sun1) failed: Error while trying to retrieve text for FS> error ORA-12505 (DBD ERROR: OCIServerAttach) at FS> /server/apache-dev/perl/test-oracle line 23 FS> ' FS> ....................................... FS> the log file of the Oracle listener on the DB box ahows: FS> 15-AUG-02 09:25:46 * FS> (CONNECT_DATA=(SID=*)(SERVICE_NAME=sun1.)(CID=(PROGRAM=)(HOST=ollenhauer)(USER=www-adm))) * (ADDRESS=(PROTOCOL=tcp)(HOST=172.22.250.27)(PORT=53048)) sh * * * 0 FS> ...................................... FS> The following versions are used: FS> apache 2.0.39 FS> mod_perl: 1.99_04 FS> DBI: 1.30 FS> DBD-Oracle: 1.12 FS> ................. FS> #sample script: FS> #!/usr/local/bin/perl -w FS> BEGIN { FS> $ENV{ORACLE_HOME} = '/opt/oracle/app/product/8.1.6'; FS> $ENV{ORACLE_SID} = 'SPD'; FS> } FS> use CGI; FS> use DBI; FS> my $db_name = 'dbi:Oracle:sun1'; FS> my $db_user = 'webuser'; FS> my $db_pass = 'topsecret'; my $q=CGI->>new; my $dbh = DBI->>connect($db_name, $db_user, $db_pass, FS> {LongReadLen => 65534, FS> RaiseError => 1, FS> AutoCommit => 0}); FS> my $query = q{ FS> SELECT count (*) FS> FROM asdb_mgr.stammdaten14 FS> WHERE bis is null }; my $sth = $dbh->>prepare($query); my $rc = $sth->>execute(); my $count = $sth->>fetchrow_array; print $q->>header; FS> print "Anzahl der SPD-MdBs: $count\n"; $sth->>finish; $dbh->>disconnect; FS> ............................... FS> httpd.conf: FS> Alias /perl /server/apache-dev/perl FS> <IfModule mod_perl.c> FS> PerlRequire "/server/apache-dev/conf/perl-startup.pl" FS> <Location /perl> FS> SetHandler perl-script FS> PerlResponseHandler ModPerl::Registry FS> PerlOptions +ParseHeaders FS> Options +ExecCGI FS> </Location> FS> </IfModule> FS> ...................................... FS> perl-startup.sh: FS> # file:perl-startup.pl FS> # --------------- FS> use Apache2 (); FS> use Apache::compat (); FS> use lib qw(/server/apache-dev/perl/); FS> use ModPerl::Util (); FS> use Apache::RequestRec (); FS> use Apache::RequestIO (); FS> use Apache::RequestUtil (); FS> use Apache::Server (); FS> use Apache::ServerUtil (); FS> use Apache::Connection (); FS> use Apache::Log (); FS> use APR::Table (); FS> use ModPerl::Registry (); FS> use Apache::Const -compile => ':common'; FS> use APR::Const -compile => ':common'; FS> 1; FS> .......................................... FS> Thanks, FS> Fredo -- WBR, Mike P. Mikhailov mailto:[EMAIL PROTECTED] You can have my Unix system when you pry it from my cold, dead fingers