01227: Changes to "InitialSetupTasks" for timezone support

Summary: Changes to "InitialSetupTasks" for timezone support
Created: 2010-09-27 10:34
Status: Closed, done
Category: Documentation
From: Steve
Assigned:
Priority: 3
Version: 2.2.18
OS: Ubuntu Linux/Apache/PHP 5.2.4

Description: InitialSetupTasks shows the following for adding timezone support:

 putenv("TZ=EST5EDT");
 $TimeFmt = '%B %d, %Y, at %I:%M %p EST';

PHP 5.1 or later uses date_default_timezone_set, so the putenv approach doesn't work on some systems. Also, there is a macro (%Z) for the timezone.

I recommend replacing these two lines with the following and adding a warning that users on PHP 4 or 5.0 need to use putenv.

 date_default_timezone_set('EST5EDT');
 $TimeFmt = '%B %d, %Y, at %I:%M %p %Z';

date_default_timezone_set works for me, while putenv("TZ=...") does not (php 5.2.15, pmwiki 2.2.21).
I don't know much of how it works, but moving putenv("TZ=...") out of config.php, e.g. in the wrapper for pmwiki.php works too.

Also isn't EST5EDT deprecated? (http://php.net/manual/en/timezones.others.php). Some of the time zones listed in Cookbook.ChangeTimeFormat e.g. CET-1CEST, are not present in the list of supported timezones from the php website (http://php.net/manual/en/timezones.php), and they don't work for me. A link to said list in InitialSetupTasks would be handy. They look like the time zones in the glibc-zoneinfo database, you could just say to look in /usr/share/zoneinfo or similar path in your local box lo find the right one.