Re: environment weirdness

From: Date: Fri, 16 Jun 2000 01:42:07 +0000
Subject: Re: environment weirdness
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2035@lists.php.net to get a copy of this message
In article <200006141715.RAA04570@smtp.ixpres.com>, radish@soltec.net (darius archer) wrote: > Hi > > I have a mod_perl fixup handler which communicates with content handlers (e.g. php) via environment variables, and I am getting strange behavior from php: Not sure what that means, but if it means what it sounds like... > if I set an environment variable in mod_perl, it shows up in php as it should and can be retrieved with getenv(). the problem is that with php those variables persist between HTTP transactions (even with no keepalive), yet they That's real hard to believe: PHP doesn't ever try to keep Env variables across HTTP requests -- There's nothing to track who would want which ones, so it would be a giant soup of everybody's variables all inter-mingled, which is pointless... So you should be getting a fresh environment each time. Except I dunno what the Perl stuff is doing to the environment or where you are getting/setting vars in the Perl fixup handler. >are _not_ accessible to apache or mod_perl either at the process level or in the apache table structures. furthermore, phpinfo() does not reflect the normal set of apache CGI-oriented environment variables (SERVER_NAME etc - which are in fact available via getenv), but it does reflect the environment of the shell from which httpd was started (e.g. SHLVL, DISPLAY and such), and it also shows If you run PHP from a shell, that shell is not going to get the Env variables by magic out of the web-server: You'll have to set them in the shell Env for PHP to get them. >the environment variables set by mod_perl during previous transactions handled by the same process. huh? Again: These vars are almost for sure not being set by PHP: Your fixup may be setting them, or you may be keeping the same shell around to run PHP in. PHP gets them from the shell you give it. > I'm not using putenv() at all, and without a php content handler this doesn't happen, but the vars created by the mod_perl fixup handler, which are supposed to expire with the transaction, are persisting within php. does php keep track of environment variables separately from the process environment? if so, where, and how do I get rid of them without knowing their exact names? I would cheerfully settle for detailed documentation too... PHP just rips through all the Env variables in the shell it runs in, and that's what's there. If you're seeing things that don't look right, it almost has to be coming from outside PHP. Disclaimer: I'm just repeating what I've heard on this list before. Don't be thinking I actually understand this stuff. -- Richard Lynch | If this was worth $$$ to you, buy a CD US Customer Support Director | from one of the artists listed here: Zend Technologies USA | http://www.L-I-E.com/artists.htm http://www.zend.com | (this has nothing to do with Zend, duh!)

« previous php.general (#2035) next »