Re: Modifying @INC on a Per-VirtualHost

André Warnier (tomcat) <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
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.
...
<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.

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.
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.