perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roman Maeder <mae...@mathconsult.ch>
Subject PerlSetEnv scoping (again)
Date Sat, 02 Jun 2001 12:29:32 GMT
back in 1998 and 99 there was a longer discussion about scoping problems
with PerlSetEnv (inside httpd.conf and .htaccess files), which ended
with fixes applied to mod_perl-1.20, which is the version I have been
using (along with apache-1.3.6 and perl 5.00404)

Now I am setting up a brand new machine to replace my aging web server
and compiled Perl 5.6.1, apache_1.3.20, and mod_perl-1.25 (Solaris 8)
and the old problem is back, only worse. This is so severe I can't
imagine it happening in all configurations out there, but here is
what I found.

Summary:

1 a variable defined with PerlSetEnv in the main server (outside any
  virtual hosts) cannot be changed inside a virtual host section (the
  change is ignored)

2 a variable defined inside a virtual host section is visible to all
  *other* virtual hosts and the main server

3 a variable defined in httpd.conf cannot be changed inside a .htaccess
  file (the change is ignored)


I set up my Apache with a minimal httpd.conf and two IP-based
virtual hosts (besides the main server), configured like this
(plus the necessary "AllowOverride All", etc.; see attached file)

    # main server
    
    DocumentRoot "/www/test/root"
    
    PerlSetEnv VarA Global
    PerlSetEnv VarB Global
    
    
    # virthost 1
    
    <VirtualHost IP1>
    DocumentRoot "/www/test/root1"
    
    PerlSetEnv VarA VirtHost1
    PerlSetEnv VarC VirtHost1
    
    </VirtualHost>
    
    
    # virthost 2
    
    <VirtualHost IP2>
    DocumentRoot "/www/test/root2"
    
    PerlSetEnv VarA VirtHost2
    
    </VirtualHost>


additionally, /www/test/root2 contains this .htaccess file

    PerlSetEnv VarB root2
    PerlSetEnv VarD root2


Using a Apache::Registry script to print the enviroment in all three
servers (main and the two virtual hosts), I get these values

Var	main		virthost1	virthost2

VarA	Global		Global*		Global*
VarB	Global		Global		Global*
VarC	VirtHost1*	VirtHost1	VirtHost1*
VarD	-		-		root2

the entries with the * are wrong, I think.

Has anyone seen something like this before?


Regards,

Roman Maeder


Mime
View raw message