Ok. I think I've figured that out
Reading documentation on Apache ResourceConfig directive. It states
--
Syntax: ResourceConfig filename
Default: ResourceConfig conf/srm.conf
Context: server config, virtual host
Status: core
The server will read this file for more directives after reading the
httpd.conf file. Filename is relative to the ServerRoot. This feature
can be disabled using:
ResourceConfig /dev/null
--
Which explains everything. I have 2 configs srm.conf and srm1.conf.
The first one is read BEFORE defining virtual servers that is why
variables from it are available in all virtual servers.
As usually I should have RTFM before complaining :)
Andrei
On Fri, Nov 19, 1999 at 10:09:33AM -0500, Andrei A. Voropaev wrote:
Let me try that.
Andrei
On Fri, Nov 19, 1999 at 03:43:40PM +0100, Eric Cholet wrote:
But do you see the behaviour I see, that is, the problem is related to
the fact that you're using ResourceConfig? If you do this:
VirtualHost host1
PerlSetVar var1 value1
/VirtualHost
VirtualHost host2
PerlSetVar var2 value2
/VirtualHost
Now when you call a script in host2 do you see var1 as being set?
Interesting. I can reproduce this problem on my machine easily. And
it's pretty painful too because customers couldn't access my second
virtual server for exactly that reason. As a quick fix I had to set
the same variable to have different values. This works perfectly.
Maybe it has something to do with the way I've set up my virtual
hosts?
I've checked few times already. I don't source srm.conf anywhere
outside of VirtualHost/VirtualHost, so the problem is not there
definetely.
Anyway, I'll read Apache documentation on setting up Virtual
Hosts. And do more testing. Basically this has come up only because I
was too lazy to change couple lines in my module to expect different
values from the same variable.
Andrei
On Fri, Nov 19, 1999 at 12:40:24PM +0100, Eric Cholet wrote:
Andrei,
I do not see this behavior if I use PerlSetVar directly inside a VirtualHost
section instead of via a ResourceConfig. I do see it if I move the directive
to the main server, so I suppose it's a scope issue with ResourceConfig.
It's Apache 1.3.9, mod_perl 1.21 on Linux.
The only change I have is patch for correcting PATH enviroment
corruption provided by Doug.
Andrei
On Tue, Nov 16, 1999 at 05:29:46PM +0100, Eric Cholet wrote:
Which version of mod_perl are you using, 1.21 or the CVS version perhaps?
Hi!
I've encountered very interesting problem. When I set some variable
using PerlSetVar in configuration files for different virtual servers
they seem to be available to ALL of those virtual servers.
Here's details to clarify.
In httpd.conf I have
VirtualHost myhost1.domain.com
ServerName myhost1.domain.com
DocumentRoot /httpd/docs
ErrorLog logs/httpd-errors
CustomLog logs/httpd-log common
AccessConfig conf/access.conf
ResourceConfig conf/srm.conf
/VirtualHost
VirtualHost myhost2.domain.com
ServerName myhost2.domain.com
DocumentRoot /httpd/docs
ErrorLog logs/httpd2-errors
CustomLog logs/httpd2-log common
AccessConfig conf/access2.conf
ResourceConfig conf/srm2.conf
/VirtualHost
Now in srm.conf I set
PerlSetVar MyVariable MyValue
PerlAuthenHandlerApache::Myhandler
And in srm2.conf I have
PerlSetVar MyVariable2 MyValue2
PerlAuthenHandlerApache::Myhandler
In Myhandler::handler I do
$myvar1 = $r-dir_config('MyVariable');
$myvar2 = $r-dir_config('MyVariable2);
if($myvar1){
## do stuff for first virtual server
}else{
## do stuff for the second one
}
But $myvar1 appears to be ALWAYS set. Which leads me to belief that
mod_perl "shares" variables between virtual servers if those variables
are not explicitly set in configuration for that server.
Is this supposed to be this way? Or am I missing something?
Andrei
--
Eric
--
--
--