Bug #361

TimeZone Error in PHP apps

Added by bigfoot65 over 12 years ago. Updated over 12 years ago.

Target version:
Start date:
Due date:
% Done:



Some Amahi applications do not work in F12 due to the timezone not being set in the /etc/php.ini file. This can be corrected by changing the following line to read:

date.timezone="America/Chicago" instead of date.timezone=""

Currently researching to see if there is a native Fedora 12 variable that holds timezone that can be used.


#1 Updated by bigfoot65 over 12 years ago

The time zone setting Fedora 12 is in /etc/sysconfig/clock. There is an entry as follows: ZONE="America/Chicago"

Does not appear to be a variable that can be used via CLI. Need to determine how to extract this information from the file and incorporate it in /etc/php.ini

#2 Updated by cpg over 12 years ago

as an environment variable it's easy for an install script to get:

[19:03:02](1)florence:~$ . /etc/sysconfig/clock
[19:03:07](1)florence:~$ echo $ZONE
America/Los Angeles

(though it should always be handled with care, probably, because of the space in there, to be more general.)

i wonder if we can put this in custom options.

the installer would always have $ZONE defined and apps that need timezone support could add it to the custom options just to get by for now.

#3 Updated by cpg over 12 years ago

we can do this in two steps. the second one being the hard one (change in the installer).

1) try this in custom options (make sure you leave the /etc/php.ini factory-intact!!):

<Files *.php>
php_value date.timezone "America/Los Angeles"

2) we can somehow replace some environment variables in the custom options, like $ZONE

#4 Updated by cpg over 12 years ago

  • Status changed from New to Closed
  • Assignee set to cpg

this was fixed in the installer for all php apps.

#5 Updated by cpg over 12 years ago

  • Status changed from Closed to Assigned

reopening ... solution was not good!

#6 Updated by cpg over 12 years ago

  • Subject changed from TimeZone Error to TimeZone Error in PHP apps

we are adding a new script called hda-php-zone-change to change the php timezone to the system timezone appropriately.

#7 Updated by Anonymous over 12 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:"1b5609d88df7b1e84e6f72307a5ac1d319a018a9".

#8 Updated by bigfoot65 over 12 years ago

Some apps display as a blank page due to the time zone being incorrectly set in php.ini. Any time zone with a space, i.e. America/Los Angeles must be set as America/Los_Angeles in the php.ini file. Any time zone with a space must have it replaced with an underscore. Those with dashes or slashes are unaffected.

Sample error message:
PHP Warning: strftime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PST/-8.0/no DST' instead in /var/hda/web-apps/horde/html/config/prefs.php on line 322, referer:

A patch has been created by cpg to correct this issue.

Also available in: Atom