My test system is PHP4 and my production system is PHP5.
Under PHP4, I previously did:
[CODE]
if( $worker[‘timezone’] )
putenv(“TZ=$worker[timezone]”);
Where $worker[‘timezone’] == “US/Pacific” for example. All works fine. New dates are in the user’s timezone as well as system generated dates.
However, under PHP5, it seems that the values for TZ have changed and “US/Pacific” is now “America/Los_Angeles”. All okay, I create a map from the PHP4 name to the PHP5 name. I then adjusted the script to:
[CODE]
if( $worker[‘timezone’] ) {
putenv(“TZ=$worker[timezone]”); // PHP4
$tzMap = array(‘US/Pacific’ => ‘America/Los_Angeles’);
if( function_exists(‘date_default_timezone_set’) ) {
putenv(“TZ=”.$tzMap[$worker[‘timezone’]]); // PHP5
date_default_timezone_set($tzMap[$worker[‘timezone’]]);
}
}
However, the date() family of functions continue to return dates formatted in the server’s timezone rather than what I set above. This is set during initialization of every page invocation.
Can anyone tell me what I’m doing incorrectly? Also, this is running on an Apache/Linux server.
thanks,
tony