Score:1

Why doesn't the timezonedb extension have the latest data?

cn flag

I've created a Dockerfile, and I use the wordpress:php7.4-apache.

I've tried to install the timezonedb extension using 3 different methods separately.

Method 1.

RUN docker-php-source extract \
    && pecl bundle -d /usr/src/php/ext timezonedb \
    && docker-php-ext-configure timezonedb \
    && docker-php-ext-install -j$(nproc) timezonedb \
    && docker-php-source delete

Method 2.

RUN mkdir -p /usr/local/src/pecl \
    && pecl bundle -d /usr/local/src/pecl timezonedb \
    && docker-php-ext-configure /usr/local/src/pecl/timezonedb \
    && docker-php-ext-install -j$(nproc) /usr/local/src/pecl/timezonedb \
    && rm -rf /usr/local/src/pecl

Method 3.

RUN apt-get -y install gcc make autoconf libc-dev pkg-config \
    && pecl install timezonedb \
    && bash -c "echo extension=timezonedb.so > /usr/local/etc/php/conf.d/docker-php-ext-timezonedb.ini"

The 3 methods work properly. After building the docker container, I confirm that the extension is installed and loaded properly by checking the PHP information:

CLI: PHP Info - CLI

Web: PHP Info - Web

The timezonedb uses the latest version which according to the pecl site is version 2022.7.

I've checked the timezonedb github file, and there should be 597 timezones.

But, upon checking the timezonedb array, I can see it only contains 420 timezones. TimezoneDB array content

So, the question is, why is it so different? What did I miss here?

Any kind of help would be much appreciated.

cn flag
What does a timezonedb verion have to do with docker or php (tagging). I would expect hat the OS image or whatever has the timezone db is outdated - there is no connection here to PHP or Docker that looks relevant.
Budianto IP avatar
cn flag
I just wanted to make sure I did it the right way, that's all.
cn flag
Nope,you did not. See, PHP is irreleant as is docker to a degree, but mostly I would point timezonedb as tag
cn flag
Given that this is a docker / Programming thing, I think this is better off at stackoverflow than serverfault.
vn flag
PHP 7.4 is end-of-lifed, so it's not that surprising instances with it are too. https://www.php.net/eol.php
Budianto IP avatar
cn flag
@TomTom, the issue I posted is related to how the timezonedb extension is installed and I needed to know whether I installed it the right way, that's why I posted it here, if you can't help, don't bother to complain, my post isn't worth your time :)
Score:3
cn flag

I think fundamentally this boils down to the tag php7.4-apache in combination with probably just what was included in the underlying OS image at the time. (As the question in the image says it uses an "external" database, I assume this is the OS-provided one.)

If you have a quick look at wordpress Dockerhub page, they have no php7.4-apache in their list of supported tags anymore.
And searching for this one finds this commit in the corresponding repository, noting how php 7.4 is EOL and they therefore removed the support for it.

Ie, it appears that everything is outdated in the image tagged this way as it is no longer maintained, not limited to the Olsen database.

I think the security side of this situation should probably be seen as more concerning than the outdated Olsen database.

I think it would probably be a good idea to pick a less specific tag (even latest, or apache, or 6 or 6-apache or whatever might fit your requirements) unless you actually have very specific requirements.
And if you do have requirements that forces you into using some more specific tag, you will simply have to keep in mind that such a specific tag will probably have a shorter lifetime than a more general one, and stay in touch with what its status is.

Budianto IP avatar
cn flag
I tried this before, the WP site was broken when I used the latest version, so I have to "lock" the image to that tag :(
Score:2
ua flag

everything all right! just try to use ALL_WITH_BC timezone group.

https://www.php.net/manual/en/class.datetimezone.php

echo 'ALL : ';
echo count(timezone_identifiers_list(DateTimeZone::ALL)); // -> result : 425
echo '<br/>';

echo 'ALL_WITH_BC : ';
echo count(timezone_identifiers_list(DateTimeZone::ALL_WITH_BC)); // -> result : 593
echo '<br/>';
Budianto IP avatar
cn flag
Thank you for your answer, the dev didn't give me detailed information on what he did. But, I think this was the workaround. I'll mark this as an answer.
Score:0
cn flag

in case anyone stumbles with the same case, I hope this helps.

So, the dev finally reached out to me, saying he finally managed to get the correct timezones.

He said he had to use the PHP wrapper to get the timezones.

This confirms that the timezonedb installation is correct.

I'd like to thank you @ceejayoz and @håkan-lindqvist for your help, I really appreciate this, took quite some time for me to solve this case.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.