Olson tz Database Update Initially Implemented in PHP

I am working on a site that makes heavy use of time zones, which should be on the edge of the absolute latest information about tz (which I have already received via tz mailing list ). I do not know how to force the PHP installations installed on my development machine, and my web host to use more modern tz data instead of the old data already on them. This is not as simple as updating PHP, because even the latest versions of PHP will not necessarily have the absolute latest tz data at any given time.

It was pointed out that the timezonedb package in pecl will lead me to the latest official version of the package, but what if I need to go a little further to get to this bleeding edge of updates that may not have been officially released yet? I am sure that the new tz data should be compiled with zic (distributed in tzcode) and the resulting binaries specified in pecl . I really don't know everything that this entails, so understanding / links for individual steps will be appreciated.

How can I update this Olson database, which is initially used by a single PHP instance on (1) the XAMPP development machine and / or (2) a typical public hosting service ... when going through as few hoops and administrative hurdles as possible? Is there any information that might be more complex than sharing a hosting environment? Is it possible to have several copies of the data present so that the changes can be easily undone if they somehow screwed them?

Since changes are sometimes not officially released on time for them to take effect, I look specifically to make these changes arbitrarily on my own. I am also interested in exploring potential trade-offs for a range of possible solutions, from quick / easy to strict / best.

+4
source share
1 answer

Final answer

The comments above give a much better answer than this - look at the PECL timezonedb package.

I converted it to a Community Wiki.


Study

A distributed source from a package such as php-5.3.8.tar.bz2 contains the translation of the Olson database into the ext/date/lib directory and the files timezonedb.h , timezonemap.h , fallbackmap.h . This means that there is code in the PHP development system that generates this information from the Olson database release, but it is not distributed by default. Moreover, it is not taken for granted as part of an SVN; I extracted the source of PHP 5.3 from version 321876, and the ext/date directory did not help (only the generated files).

So, it may be appropriate to ask supportive PHP how to do this; it certainly should be possible, and it should be automated (it would be foolish if they were not automated). But it is not clear to me that those who are outside of supporting PHP can tell how to do this.

Comments in the NEWS file indicate that Derick Rethans may be a good person to contact - he upgraded the database to Olson 2010c (2010.3). You can find his PHP email address in the run-tests.php at the top level of the source directory; you can find the alternate email address in the source in the ext/date/lib directory.

Derick Rethans provided a set of conversion tools used to create the timezonedb.h file from the Olson database:

http://svn.xdebug.org/cgi-bin/viewvc.cgi/timelib/trunk/zones/?root=php

Starting from 2016-12-09, the link is above 404, and the WayBack Machine on the Internet Archive cannot help, because the search in the robots.txt file could not be performed.

However, a google search for "php timelib" finds:

which is almost certainly a replacement.

+3
source

Source: https://habr.com/ru/post/1389821/


All Articles