Re: Modifying @INC on a Per-VirtualHost

Ben RUBSON <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
> On 20 Aug 2017, at 11:28, André Warnier (tomcat) <[email protected]> wrote:
> 
> On 19.08.2017 23:29, Ben RUBSON wrote:
>>> On 19 Aug 2017, at 22:40, Ben RUBSON <[email protected]> wrote:
>>> 
>>> Hi list,
>>> 
>>> I have a question regarding tuning @INC at VirtualHost level, with prefork MPM.
>>> (...)
>>> will I have 2 (2 different PerlSwitches configurations)
>>> or 11 (11 different VH using PerlSwitches) interpreters launched ?
>> 
>> Well, reading at Parent (which is needed), gave me the answer :
>> https://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_
>> 
>> I will have 11 interpreters.
>> 
>> So a better configuration would be :
>> 
>> PerlSwitches -T -I/home/production/lib/perl
>> <VirtualHost prod1>
>>     ...
>> </VirtualHost>
>> <VirtualHost prod2>
>>     ...
>> </VirtualHost>
>> <VirtualHost prodn>
>>     ...
>> </VirtualHost>
>> 
>> <VirtualHost dev>
>>     PerlOptions +Parent
>>     PerlSwitches -I/home/development/lib/perl
>> </VirtualHost>
>> 
>> However, here is what I have reaching VH dev :
>> [warn] -T switch is ignored, enable with 'PerlSwitches -T' in httpd.conf
>> And according to ${^TAINT}, taint is no more enabled in VH dev.
>> Any workaround ?
>> 
> 
> Maybe another possible solution for what I think you are trying to achieve.

Thank you very much for your answer André, hum, André !

> ...
> <VirtualHost dev>
>  ProxyPass "/" "http://dev.sameserver.local:8000/"
>  ProxyPassReverse "/" "http://dev.sameserver.local:8000/"
> </VirtualHost>
> 
> Add this to the local /etc/hosts file:
> 127.0.0.1 dev.sameserver.local
> 
> and run *another Apache instance*, with another perl/mod_perl, on port 8000,
> with a
> <VirtualHost *:8000>
>  ServerName dev.sameserver.local
> ...
> </VirtualHost>
> and watever @INC you want.

Yes why not, this is a nice solution !

> For the clients, it will look just the same (they continue to access "http://dev.company.com:80/*"). There will be a (very small) overhead for the proxying, but which affects only your dev people.
> You can (carefully) share a DocumentRoot and whatever with the main instance, or not.
> And it will certainly use less memory than 11 perl interpreters per Apache child.

With the solution in my second mail (you quoted above), I just only have 2 interpreter pools : the one for all prod VH, and the one for the dev VH.
So seems to be OK in terms of interpreters consumption.
I managed to get ride of the taint warning, and to get taint enabled in the dev VH adding this to the dev VH config :
PerlTaintCheck on
Seems however to be a mod_perl 1.0 config option, so I don't know if it is a best practice or not to still use it...
I don't know if we should prefer in any way "PerlSwitches -T", or if "PerlTaintCheck on" is OK / has exactly the same effect / has no overhead etc...

Thank you again !

Ben
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.