You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rasmus Lerdorf <ra...@php.net> on 2000/04/05 17:22:11 UTC

setenv/unsetenv?

Could someone remind me of the reason for not having the mod_env
setenv/unsetenv modify the real environment as well as modifying the
internal table?

It is a bit of a hassle to not have an unsetenv in httpd.conf apply to
directly linked 3rd-party libs that are written to look at the real
environment with a straight getenv() call.

-Rasmus


Re: setenv/unsetenv?

Posted by Rasmus Lerdorf <ra...@apache.org>.
> From: "Rasmus Lerdorf" <ra...@php.net>
> Sent: Wednesday, April 05, 2000 8:22 AM
>
>
> > Could someone remind me of the reason for not having the mod_env
> > setenv/unsetenv modify the real environment as well as modifying the
> > internal table?
> >
> > It is a bit of a hassle to not have an unsetenv in httpd.conf apply to
> > directly linked 3rd-party libs that are written to look at the real
> > environment with a straight getenv() call.
>
> Sounds hopelessly un-thread-safe

Yeah well, that's not really an answer for Apache-1.3 on UNIX.  Was there
another reason for not modifying the env directly?

-Rasmus


Re: setenv/unsetenv?

Posted by "William A. Rowe, Jr." <ad...@rowe-clan.net>.
From: "Rasmus Lerdorf" <ra...@php.net>
Sent: Wednesday, April 05, 2000 8:22 AM


> Could someone remind me of the reason for not having the mod_env
> setenv/unsetenv modify the real environment as well as modifying the
> internal table?
> 
> It is a bit of a hassle to not have an unsetenv in httpd.conf apply to
> directly linked 3rd-party libs that are written to look at the real
> environment with a straight getenv() call.

Sounds hopelessly un-thread-safe


Re: setenv/unsetenv?

Posted by Rasmus Lerdorf <ra...@apache.org>.
> On Wed, 5 Apr 2000, Rasmus Lerdorf wrote:
>
> > Could someone remind me of the reason for not having the mod_env
> > setenv/unsetenv modify the real environment as well as modifying the
> > internal table?
>
> Aside from the thread safety issues on threaded platforms, there are
> performance issues.  All the ways to set variables should either all not
> set them as "real" environment variables or should set them only in the
> Apache tables (modulo cases like mod_cgi), since otherways you introduce
> even more confusion.  So setting per-request ones with setenv() would be a
> major nasty, since many setenv() implemenations are... not known for their
> performance friendly nature.

But what about the poor user who sticks an unsetenv into their
global-scope httpd.conf expecting it to unset a database-related
environment variable like ORACLE_HOME or PGHOST or something along those
lines such that any Apache module like mod_auth_*, PHP, mod_perl, etc.
will not use that env variable.  It is somewhat confusing that this works
for CGI and mod_include, but nowhere else.

-Rasmus


Re: setenv/unsetenv?

Posted by Marc Slemko <ma...@znep.com>.
On Wed, 5 Apr 2000, Rasmus Lerdorf wrote:

> Could someone remind me of the reason for not having the mod_env
> setenv/unsetenv modify the real environment as well as modifying the
> internal table?

Aside from the thread safety issues on threaded platforms, there are
performance issues.  All the ways to set variables should either all not
set them as "real" environment variables or should set them only in the
Apache tables (modulo cases like mod_cgi), since otherways you introduce
even more confusion.  So setting per-request ones with setenv() would be a
major nasty, since many setenv() implemenations are... not known for their
performance friendly nature.