4

I'm working on a site that makes heavy use of time zones which needs to be on the bleeding edge of the absolute latest tz information available (which I already get through the tz mailing list). What I don't know is how to get the PHP installations running on my development machine and my web host to use more up-to-date tz data instead of the older data already on them. This isn't as simple as just upgrading PHP, since even the newest versions of PHP won't necessarily have the absolute latest tz data at any given time.

It's been pointed out that the timezonedb package in pecl will get me to the latest official release of the package, but what if I need to go a little further to get to that "bleeding edge" of updates that may not have been officially released yet? I'm pretty sure that the newer tz data would have to be compiled with zic (distributed in tzcode), and the resulting binaries given to pecl. I really don't know all that this entails, so insight/links for individual steps would be appreciated.

How can one upgrade this Olson database that is used natively by one's instances of PHP on (1) a XAMPP development machine and/or (2) a typical shared hosting service... while jumping through as few hoops and administrative hurdles as possible? Are there any particulars which a shared hosting environment might make more difficult that one should be aware of? Is it feasible to have multiple copies of the data present so that changes could easily be undone if one somehow screws them up?

Since changes sometimes aren't officially released in time for them to take effect, I'm looking specifically for a way to be able to make these changes arbitrarily on my own. I'm also interested in exploring potential tradeoffs over a range of possible solutions from "quick/easy" to "rigorous/best".

Tim Parenti
  • 511
  • 7
  • 26
  • 1
    Install the pecl package. Update only the pecl extension then. See http://pecl.php.net/package/timezonedb – hakre Jan 07 '12 at 17:08
  • That looks good; I'll edit my question. But what if I need even more fine-grained control than `pecl` allows, such as making changes that haven't yet been officially released? – Tim Parenti Jan 07 '12 at 17:26
  • 1
    Help with the PECL package naturally so that releases are in time. Just get involved at the right place, that's why we use free software. And that's what the package has been made for. It looks like it's *your* use-case. – hakre Jan 07 '12 at 17:31
  • _Yay; I have somewhere to get involved!!!!_ I'm already on the tz discussion list, too, but sometimes there are updates which affect current timestamps that aren't even released as tz updates in time, let alone as `pecl` packages. Obviously, getting involved there would help me understand how the compilation/installation process works and allow me to install my own "beta" versions locally if I really need them. I'll leave the question open in case anyone (perhaps even later me) wants to try to tackle the technical aspects for the public good, as there seems to be a dearth of such resources. – Tim Parenti Jan 07 '12 at 17:46
  • Hi, Although the tools used to translate the Olson time zone database to generate the timezone*.h files are not distributed by default with PHP, you can still find them here: http://svn.xdebug.org/cgi-bin/viewvc.cgi/timelib/trunk/zones/?root=php – Radu Gasler Mar 21 '12 at 09:58

1 Answers1

3

Definitive Answer

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

I've converted this to Community Wiki.


An Investigation

The distributed source from a package such as php-5.3.8.tar.bz2 contains a translation of the Olson database in the ext/date/lib directory and files timezonedb.h, timezonemap.h, fallbackmap.h. This means that there is code somewhere in the PHP development system that generates this information from a release of the Olson database, but it is not distributed by default. Further, it is not self-evidently distributed as part of SVN; I extracted PHP 5.3 source as of revision 321876 and the ext/date directory contained nothing to assist (just the generated files).

So, it might be appropriate to ask the PHP maintainers how to do it; it certainly should be possible, and it should be automated (it would be silly if they do not have it automated). But it is not clear to me that those outside the PHP maintainers can tell how to do it.

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

Derick Rethans made available the conversion tool kit used to generate the file timezonedb.h from the Olson database here:

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

As of 2016-12-09, the link above is 404, and the WayBack Machine at the Internet Archive can't help because it was not allowed to search by a robots.txt file.

However, a Google search for 'php timelib' finds:

which is almost certainly the replacement.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • Because I marked it as CW when I wrote the answer, AFAICT. – Jonathan Leffler Sep 10 '14 at 13:30
  • My point is, it shouldn't be. Community Wiki should be reserved for posts/questions that generate huge number of edits and/or upvotes so that authors don't get unfair amount of reputation. It's not the case here. I recommend removing the CW status. – Radu Murzea Oct 17 '14 at 12:19
  • The link to Rethans' post is broken -.- – dev4life Dec 10 '16 at 05:20
  • @user2070775: Thanks for the heads up. I've updated the answer with new information about where you can (probably) get the code from now. – Jonathan Leffler Dec 10 '16 at 06:14