On Sun, 4 Jun 2000, Ben Cohen wrote:
> The problem is that when a mod_perl script modifies the PATH
> environment variable, this change seems to become global and
> affects even plain old mod_cgi scripts.
While I also wonder (as another respondent did) why a mod_perl script would
need to alter its 'PATH', I can think of a couple solutions that might work:
Probably the simplest is to localize your $ENV{'PATH'} changes
(i.e. local $ENV{'PATH'} = '/bin:/usr/bin' ) in your code.
More complicated and less nice solution:
Write a FixupHandler that sets the PATH to some 'clean' value.
Something like this:
sub handler {
my $r = shift;
$ENV{'PATH'} = '/bin:/usr/bin';
$r->subprocess_env('PATH', $ENV{'PATH'}); # just to be sure mod_cgi gets it
return DECLINED;
}
...and then have it triggered by a <FilesMatch "\.cgi"> in your httpd.conf.