[SOLVED] Timezone TZ broken for PHP7

I am using PHP7 on openwrt. Timezone 'UTC' works perfectly, However, setting another one in /etc/config/system, i.g.
option timezone 'CET-1CEST,M3.5.0,M10.5.0/3'
option zonename 'Europe/Berlin'
breaks the following demo:

<?php echo date("Y"); echo date("H:i:s"); ?>

Output:
Fatal error: date(): Timezone database is corrupt - this should never happen! in /www/ui/test.php on line 2

The interesting fact is, that this happens both using following option in make menuconfig - languages - PHP:

  • Use system timezone data instead of php's built-in database
    Use system timezone data instead of php's built-in database

Although in Makefile for PHP7 following comment:
config PHP7_SYSTEMTZDATA
bool "Use system timezone data instead of php's built-in database"
depends on PACKAGE_php7-cli || PACKAGE_php7-cgi
default y
help
Enabling this feature automatically selects the zoneinfo-core package which contains data for UTC timezone. To use other timezones you have to install the corresponding zoneinfo-... package(s).

Question: Where to find the "corresponding zoneinfo-package" to use TZ for Europe/Berlin ?
Searching for "timezone" during 'make menuconfig' gives no meaningful result.

1 Like

You forgot clock time from the spring date. (Might be just a typo here, or an actual error.)

'CET-1CEST,M3.5.0/2,M10.5.0/3'

zoneinfo-europe sounds natural to me...

E.g.

Name & version --- ---
zoneinfo-africa_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 7.9 KB Sun Sep 6 10:30:21 2020
zoneinfo-asia_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 30.6 KB Sun Sep 6 10:30:25 2020
zoneinfo-atlantic_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 6.7 KB Sun Sep 6 10:30:26 2020
zoneinfo-australia-nz_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 7.3 KB Sun Sep 6 10:30:27 2020
zoneinfo-core_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 20.5 KB Sun Sep 6 10:30:20 2020
zoneinfo-europe_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 21.6 KB Sun Sep 6 10:30:29 2020
zoneinfo-india_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 1.7 KB Sun Sep 6 10:30:29 2020
zoneinfo-northamerica_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 77.6 KB Sun Sep 6 10:30:22 2020
zoneinfo-pacific_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 7.9 KB Sun Sep 6 10:30:27 2020
zoneinfo-poles_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 5.3 KB Sun Sep 6 10:30:24 2020
zoneinfo-simple_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 17.0 KB Sun Sep 6 10:30:19 2020
zoneinfo-southamerica_2020a-1_arm_cortex-a15_neon-vfpv4.ipk 5.5 KB Sun Sep 6 10:30:23 2020
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.