Apache2 - setting PERL5LIB via SetEnv under CGI

Posted by j0nes on Server Fault See other posts from Server Fault or by j0nes
Published on 2010-04-07T19:23:47Z Indexed on 2010/04/07 19:33 UTC
Read the original article Hit count: 501

Filed under:
|
|
|
|

Hi,

my setup is as follows: I have one Apache2 webserver running different vhosts, one vhost is for the production website, the other vhost is for a staging / preview system. Both vhosts have different DocumentRoots and also different (Perl) CGI folders. The used modules for each of these vhosts should be in different directories, so I did the following:

<VirtualHost...>
ServerName production
SetEnv PERL5LIB /home/production/modules
</VirtualHost>

<VirtualHost...>
ServerName staging
SetEnv PERL5LIB /home/staging/modules
</VirtualHost>

However, I just noticed that in my Perl CGI scripts, both paths get filled into my @INC, so I can not separate the staging modules from the production modules, e.g. the SetEnv directive is not limited to a single virtual host, but seems to work globally.

How can I solve this?

Thanks! Jonas

© Server Fault or respective owner

Related posts about perl

Related posts about apache2