Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After updating the system tzdata package, will PHP use this new data?

Tags:

timezone

php

I want to keep my PHP time zone info up to date. When we update the system's tzdata package, will PHP use this updated info?

Currently phpinfo() reports

"Olson" Timezone Database Version => 0.system

But does that mean PHP is using the system's database (which is getting updated), or just the time zone database from when the PHP package was distributed?

I know that we can install the pecl package timezonedb to get updated information, but it seems preferable to only have to update one package. We are already updating tzdata.

like image 210
matt Avatar asked Sep 01 '25 01:09

matt


1 Answers

According to the notes from the timezone_version_get function, 0.system means that you are using the version that PHP shipped with. It does not mean that you are using the tzdata from your operating system.

On each release of PHP, the most current timezonedb package data is incorporated into the PHP distribution. However, a new release of the time zone database doesn't necessarily force a release of PHP. Therefore, if you want the most current version of the time zone data, then your only option is to update the timezonedb package yourself.

like image 100
Matt Johnson-Pint Avatar answered Sep 02 '25 15:09

Matt Johnson-Pint