Re: What's the scope of putenv()?

[email protected] (Rasmus Lerdorf)
Newsgroups php.i18n
Message-ID <2005081100110416807%rasmus@phpnet>
On 2005-08-08 11:51:32 -0700, [email protected] (Karen Andrien) said:
> However, I haven't been able to find any information on the scope of
> the putenv() statement.  What happens if users from Vancouver and
> Toronto log on at the same time?

Assuming you are running a multi-process web server like Apache1 or Apache2
with the prefork mpm, then there is no problem.  The TZ env var will be 
per-request.
PHP takes care of resetting it at the end of each request.

The PHP documentation says putenv() applies "for the current request"
> only, but several users on the documentation page disagree.  They claim
> that putenv() has changed the time zone for both the current request
> and other future requests at random.
> 
They are either wrong, or they are using a multithreaded server like IIS.

There is actually a new ext/date extension on the way which provides 
this capability
separate from the OS-level locale stuff you are looking at to attempt 
to fix variances
at the OS level messing up portability.

-Rasmus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.