Question

phpinfo() shows our system to be using ""Olson" Timezone Database Version 2010.3". I think that is now out of date, but can't locate an authoritative location which can confirm that.

(a) Can I update the timezones info for PHP as a whole? (b) If so, how do I update this? I saw the instructions at http://www.electrictoolbox.com/correct-php-timezone/ where it says that, after installing the appropriate module, it says I have to:

You should add "extension=timezonedb.so" to php.ini

Do we need to do that? Shouldn't PHP be automatically using the correct file?

No correct solution

OTHER TIPS

as far as I know the Timezone DB (TDB) is distributed within PHP itself. Because of that the timezone DB becomes obsolete after some time and you should either update PHP or the TDB to reflect the changes in TDB.

There's a PECL extension which releases new TDB packages which you can download and install and use them in your old PHP installations.

I'm not aware there's a way to update TDB directly in PHP. The PECL extension was created to target this issue.

It's better just to update your PHP version (specially, if you're wanting to update it on a windows machine, otherwise you have to compile the extension yourself) because as far as i remember the extension isn't Windows-Ready only unix/linux - so if you want to do it on windows you will have to compile it yourself using the VC6 OR VC9 compiler).

So, if you can update your PHP version that would be the fastest solution (it was atleast for me), ofcourse PHP may not have the latest timezone db info but i had to resolve a issue with the timezone db and it was fixed in the later version of PHP that i had. If you're doing it for unix/linux you might as well try the PECL extension i think that might be easier & faster for you then.

The PECL extension is literally the timezone DB. Every time a new version of the DB is released from here, the extension is recompiled with the updated timezone DB.

So, you would actually overwrite the old extension with newly recompiled version and restart your web server; assuming PHP is being used as a module.

To do a complete timezone update (We had problems with incorrect Russia / Moscow timezone):

#for OS - CentOS and MySQL
yum update tzdata
mysql_tzinfo_to_sql /usr/share/zoneinfo
#for PHP
pecl upgrade timezonedb
pecl upgrade intl

#dependencies you may need for the above:
yum install gcc 
yum install gcc-c++
yum install libicu-devel
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top