Resolved UTC time issue (Plesk PHP 7.3 / 7.4 on Centos7)

jpveen

New Pleskian
Hi all,
I just migrated from a Plesk Onyx at Centos6 to a Plesk Obsidian at Centos7 with my sites. However I have multiple issues with Wordpress sites, and they all seem to be caused by issues with UTC time in PHP7.3.

The issue is that PHP does not display the correct UTC time, however all other timezones are displayed correctly (GMT, CEST).
On my old server (Centos6-Onyx-PHP7.3.16) this does not happen. There is UTC the same as GMT, but on my new server (Centos7-Obsidian-PHP7.3.16) the local time is displayed at UTC instead of the real UTC time.
See the example below. The UTC time on the new server is 21.0x while it should be 19.0x (as on the old server).

new server output:
[root@h2879813 ~]# cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)
[root@h2879813 ~]# timedatectl
Local time: di 2020-04-14 21:00:06 CEST
Universal time: di 2020-04-14 19:00:06 UTC
RTC time: n/a
Time zone: Europe/Amsterdam (CEST, +0200)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
zo 2020-03-29 01:59:59 CET
zo 2020-03-29 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
zo 2020-10-25 02:59:59 CEST
zo 2020-10-25 02:00:00 CET
[root@h2879813 ~]# /opt/plesk/php/7.3/bin/php -a
Interactive shell

php > date_default_timezone_set( 'GMT' );
php > echo date('Y-m-d G:i:s');
2020-04-14 19:00:20
php > date_default_timezone_set( 'UTC' );
php > echo date('Y-m-d G:i:s');
2020-04-14 21:00:28
php > date_default_timezone_set( 'Europe/Amsterdam' );
php > echo date('Y-m-d G:i:s');
2020-04-14 21:00:36
php >

old server:
[root@h2429770 ~]# cat /etc/centos-release
CentOS release 6.10 (Final)
[root@h2429770 ~]# date
Tue Apr 14 21:02:41 CEST 2020
[root@h2429770 ~]# /opt/plesk/php/7.3/bin/php -a
Interactive shell

php > date_default_timezone_set( 'GMT' );
php > echo date('Y-m-d G:i:s');
2020-04-14 19:03:03
php > date_default_timezone_set( 'UTC' );
php > echo date('Y-m-d G:i:s');
2020-04-14 19:03:14
php > date_default_timezone_set( 'Europe/Amsterdam' );
php > echo date('Y-m-d G:i:s');
2020-04-14 21:03:26
php >


Of course I tried a lot to fix the issue. Changing php.ini, changing server timezone etc. But still issue persists.
It looks like that the timezonedb is wrong in the plesk-php. I even tried to use the new timezonedb from pecl. But I could only update the system php version with that, and that fixed the issue for the old 5.x system php version. But of course could not/dont want to change the php version from plesk.

So the problem persists, and I am clueless.... Any ideas how I can fix this?

Thanks in advance for help and thoughts.
Jan-Pieter
 
Last edited:
With the help of Peter I managed to find the root cause, wrong contents of the UTC file on Centos. So issue is finally fixed.

Anybody who has this issue that PHP UTC time is incorrect (and therefore all kind of things go wrong with WordPress publish , customizer etc. check the contents of the UTC file in /usr/share/zoneinfo/UTC .
That should be a small file and should not contain references to other timezones!

Correct output:
[root@h2879813 zoneinfo]# strings /usr/share/zoneinfo/UTC
TZif2
TZif2
UTC0

In case you have the same issue, do not edit this file directly, because it also contains binary. I attached the correct file which worked on Centos7.
Cheers ;-)
 

Attachments

  • CentOS7-correct-UTC-file.zip
    332 bytes · Views: 84
how do i change the file?

my output is now:
[root@h2889654 ~]# strings /usr/share/zoneinfo/UTC
TZif5
+0020
+0120
CEST
TZif2
+0020
+0120
CEST
CET-1CEST,M3.5.0,M10.5.0/3

But how do i upload/change the file?
 
Editing not possible (not easy) as far as I know. Use for example winscp to upload the file I attached above to your server and replace the file itself. (Make a backup of the file upfront.) If you need help you can also send me a direct email to platinum at planet.nl
 
HI thanks very much for the post with the correct UTC file ... this solved my problem!
Will this be solved in next releases?
 
Back
Top