Showing posts with label Timezone. Show all posts
Showing posts with label Timezone. Show all posts

Tuesday, March 20, 2007

date.timezone setting error in MediaWiki, phpMyAdmin in Cygwin and Linux

I've only encountered this problem in Cygwin and install-from-source-code Linux. Apparently after PHP 5.1 released, it generates following warning/error message about timezone information (read entry at Date/time support).

It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 '... for '...' instead in ... on line ....

Anyway this is how I fixed the problem.

  1. Add following line in PHP code
    date_default_timezone_set("America/Denver");

  2. Edit PHP.ini file
    To solve the problem, you can enter the timezone setting manually on php.ini file. You can change the following lines in php.ini
    [Date]
    ;date.timezone =

    to
    [Date]
    date.timezone = America/Denver

    Here are the lists of supported timezones.

  3. Using TZ environment variable
    This is how I fixed the problem in Cygwin. Enter the following lines in ther terminal if you have access to shell. However as of PHP 5.1.0, this will also generate warning message.
    TZ='US/Mountain;
    export TZ

Saturday, December 30, 2006

Cygwin Time Zone Part 2

I should have read the warning message carefully. Just like what the message said, my TZ variable was wrong. It was set to:

$ env | grep TZ
TZ=MST7MDT6,M4.1.0/2,M10.5.0/2

Fixed the problem by

$ TZ='US/Mountain'; export TZ

Thursday, December 28, 2006

Cygwin Time Zone

I finally got PHP to work but now I'm getting this warning message in phpinfo().

It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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.

Update: Read