2

There was a timezone issue in a PHP application running on Fedora I worked on and I am curious to know the difference between tzdata and timezonedb and how does PHP use them to calculate the timezome?

The issue was that 'Europe/Moscow' should be GMT+3 but PHP added one hour i.e. GMT+4. Most of the solutions are about running

pecl upgrade timezonedb

check Incomplete list of timezones generated by PHP

Without installing timezonedb extension, we updated tzdata

yum update tzdata

and then the issue was fixed!

So, Does PHP use tzdata if timezonedb is not installed or what?

PHP: 5.5.18
OS : Fedora 19

Community
  • 1
  • 1
Mark Shehata
  • 151
  • 1
  • 12

2 Answers2

0

One of the databases (tzdata) ships with PHP, this is used by default. A later version of the db can to be installed separately on the system via PECL.

Pecl timezonedb extension indicates there is an embedded db by default.

This extension is a drop-in replacement for the builtin timezone database that comes with PHP. You should only install this extension in case you need to get a later version of the timezone database than the one that ships with PHP.

quickshiftin
  • 66,362
  • 10
  • 68
  • 89
-1

For centos 6 users with php 5.5+ use this:

yum -y update tzdata
pecl channel-update pecl.php.net
pecl install --ignore-errors  timezonedb
echo "extension=timezonedb.so" > /etc/php.d/timezonedb.ini