I'm trying to display times on my site in the user's local timezone. I converted all the data from /usr/share/zoneinfo into a MySQL table and let the user choose their timezone based on their country.
However, when I try and use putenv("TZ=$user_timezone") the results have been very inconsistent.
First of all, it doesn't seem to work until the second time it gets called. Also, how long does the environment variable stay changed, and does it change it for the whole server, or just that child process or what? If 2 people are hitting the site at once, are their putenv() calls overwriting each other?
I have gone over all the user comments about putenv() and date() at php.net and there seems to be conflicting information there, so anyone who has any experience with this I'd appreciate the advice.