Hi there, I'm researching how to implement timezones in PHP, and found a wealth of information on the subject. For Linux users, it all seems to boil down to one recommendation: use the putenv("TZ=xxx") statement.
The software I'm working on needs to be able to display a grid of hours for the current date, for a user in any timezone. (The timezone can be passed to the script as, e.g., $_COOKIE['TZ'] = 'America/Vancouver'.) So far so good. putenv() will change the timezone environment variable and the operating system will take care of the rest transparently. 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? 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. Can anybody clarify the putenv() scope for me? My best guess is that the scope is PHP request-level, but Apache session-level. When putenv() is called, it applies to the current Apache session, and all future connections which happen to arrive on the same connection. If this is true, I would simply have to restore putenv() to the default at the end of the script. But I don't want to test this on my system in case I'm wrong. I don't have a separate development machine. Here are all the possibilities I've thought of: * Current PHP request only * Current PHP session only (including future requests) * Current PHP process only (including random future requests) * All of PHP (including other current requests) * Current Apache request only * Current Apache connection only (including random future requests) * All of Apache (including other current connections) * All of Linux (this is such a bad idea that I'm sure it's wrong) Thanks very much, Karen Andrien __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP Internationalization Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php