大网数据广告活动
服务器运维问答

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

· 52CE 我爱测

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 …

问题原文

原帖链接 · Budianto IP · CC BY-SA 4.0

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:

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.

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

Any kind of help would be much appreciated.

已采纳解答

原帖链接 · Abbas Bagheri · CC BY-SA 4.0

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/>';

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-02-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。