sgifford has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I'm working on porting some code that's been running on mod_perl 1 for a very long time to mod_perl 2. Mostly things have gone smoothly, but I'm having trouble with environment variables. Sometimes my scripts go off and run other scripts, and expect to be able to set things like $ENV{PATH} for the child processes. However, for some reason under mod_perl 2, my environment variables aren't getting passed to child processes! Quite bizarre.
Here's an example:
The proper output seems pretty obvious, right? And that's what it does when I run it from the command-line. But under mod_perl 2, instead I see:#!/usr/bin/perl -T use strict; use warnings; print "Content-type: text/plain\n\n"; $ENV{PATH}="/usr/bin"; print "PARENT: PATH is $ENV{PATH}\n"; print " CHILD: PATH is ",`echo \$PATH`,"\n";
PARENT: PATH is /usr/bin CHILD: PATH is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbi +n:/bin:/usr/X11R6/bin
I'm using Ubuntu 8.04 and its default Perl (5.8.8), Apache (2.2.8), and mod_perl (2.0.3). My Apache configuration looks roughly like this:
Any suggestions would be appreciated!<Location /cgi-perl> Options +ExecCGI PerlSendHeader On SetHandler perl-script PerlHandler ModPerl::Registry PerlOptions +SetupEnv allow from all </Location>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Environment variables under mod_perl 2
by ysth (Canon) on Jun 03, 2009 at 07:42 UTC | |
Re: Environment variables under mod_perl 2
by Anonymous Monk on Jun 03, 2009 at 07:11 UTC | |
Re: Environment variables under mod_perl 2
by Anonymous Monk on Jun 03, 2009 at 07:01 UTC | |
Re: Environment variables under mod_perl 2
by sgifford (Prior) on Jun 03, 2009 at 18:56 UTC |
Back to
Seekers of Perl Wisdom