• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Server time / UTC

Johan

New Pleskian
Hi there,

I seem to be having huge issues with server time.
My wordpress webshop is showing 3 different timezones.
Ofcourse first i was taking a look at my Wordpress instance for any plugin/theme/setting regarding timezones.
After disabling all plugins / new instance with only WP and transfering the same WP to my other Linux Plesk install (worked fine) i know it has something to-do with my Plesk server.

As you can see on the screenshot below there are 2 different timestamps when an order has been made:
3500e171a2550655860688b9fdf0e6be.png
(scroll over the 4:16 gives me this time)

3500e171a2550655860688b9fdf0e6be.png

3500e171a2550655860688b9fdf0e6be.png

And when you would go to the order status page the new order shows as 4 hours ago.
There are some ways to set the timezone different in WP only that resulted at all new posts/pages were not possible to publish because they could only be sceduled since you were in the "future".
The new, just created WP shows the UTC as local time and my local time as +2 hours in the future.
4dd4073392348bd2cbc53d24a7a5cf10.png

4dd4073392348bd2cbc53d24a7a5cf10.png


So something goes wrong because when i transfer this WP to my other server, everything goes fine.
My server output through SSH seems fine (its ~12:48 now):
08f43e035c5ca0fcaf17b3d22d25803d.png

26d6f77edc944d857ba63c2dd9831787.png


PHP Output:
6f8a4c0f56e461a396f0b055a70ede7f.png

fc4825d53aed770de910bed06ae7bb1a.png

fc4825d53aed770de910bed06ae7bb1a.png


71fef582930dcf89e0eee5774f57bc17.png
(changed this too, didn't worked out well

Server time:

73b83294b27b5a7f27febc4c7dcf180f.png
(changed this, didnt worked out well)

I am working on this issue for quite some time and thinking about starting a complete new server again so resolve this since we're having problems with payment methodes due to the max transaction time.
 
Last edited:
The correct solution is to change the php .ini-file setting as you have already tried it. However, it should be set in the "additional PHP directives" on the PHP configuration page of the subscription, e.g. with
date.timezone = Europe/Amsterdam
 
The correct solution is to change the php .ini-file setting as you have already tried it. However, it should be set in the "additional PHP directives" on the PHP configuration page of the subscription, e.g. with
date.timezone = Europe/Amsterdam
Thank you for your reply Peter.
I've tried this just now, only the problem seems to be still there.
Can it be something in the database? MySQL using its own timezone maybe?
 
Not in the database, but maybe your shop software has a configuration page where you can set the timezone?
 
Not in the database, but maybe your shop software has a configuration page where you can set the timezone?

Already checked that, even installed a complete new WP install sadly enough with the same problem.
Really can't find any clue where this is coming from though.
 
Hi Johan, I seem to have the same issue. I tracked it down to a wrong php UTC time on my environment. But unsure how to fix. How did you in the end fix your problem?
 
I seem to have the same issue. I tracked it down to a wrong php UTC time on my environment. But unsure how to fix. How did you in the end fix your problem?
If setting the timezone in the "Additional PHP directives" does not work for you, you can always set a default timezone in the php.ini files of your Plesk PHP versions, e.g in the files
Code:
/opt/plesk/php/<PHP version>/etc/php.ini
like this
Code:
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Berlin
(Uncomment the "date.timezone" line and add the timezone of your choice to it.)
 
Hi Peter,
Thanks for your reply. Changing php.ini does not fix the issue, the problem is only with UTC timezone, not with every other. I opened a new thread to explain the problem, but replied also on this old thread because the issue looked quite similar.
 
I am rather sure that the solution is correct. Have you restarted the PHP services after the change? Else the change won't be applied. E.G.
# service plesk-php56-fpm restart
# service plesk-php70-fpm restart
# service plesk-php71-fpm restart
# service plesk-php72-fpm restart
# service plesk-php73-fpm restart
# service plesk-php74-fpm restart
(Omit the #.)
 
Sure:
[root@h2879813 ~]# service plesk-php73-fpm restart
Redirecting to /bin/systemctl restart plesk-php73-fpm.service
[root@h2879813 ~]# /bin/systemctl restart plesk-php73-fpm.service
[root@h2879813 ~]#
[root@h2879813 ~]# /opt/plesk/php/7.3/bin/php -a
Interactive shell

php > echo date('Y-m-d G:i:s');
2020-04-15 10:04:21
php > date_default_timezone_set( 'GMT' );
php > echo date('Y-m-d G:i:s');
2020-04-15 8:06:13
php > date_default_timezone_set( 'UTC' );
php > echo date('Y-m-d G:i:s');
2020-04-15 10:06:19
php > date_default_timezone_set( 'Europe/Amsterdam' );
php > echo date('Y-m-d G:i:s');
2020-04-15 10:06:29
php > date_default_timezone_set( 'Europe/Berlin' );
php > echo date('Y-m-d G:i:s');
2020-04-15 10:06:35

The problem is the UTC time which is wrong in this output. In my opinion this does not depend on the PHP ini date.timezone setting...
 
Ah, I see. The UTC time is derived from the server time setting. What is the shell output of
# date
?

What time server are you using (Tools & Settings > System Time )?
 
You should also check that your OS recognizes UTC, maybe that portion of the OS is damaged.
# ls /usr/share/zoneinfo
should include UTC.

Edit: And I also found this:
  • Set the timezone offset with something like: ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime
  • Check the contents of /etc/sysconfig/clock - should contain your zone like ZONE="Europe/Berlin"
  • Turn on ntp (network time protocol)
  • If this is a physical system, check what your hardware clock is saying (#hwclock), or you may want to set your hardware clock in your bios or set it from your OS with hwclock -w
 
Thanks Peter, this is a great tip. The UTC is listed, but the contents seem wrong !!
Old Centos6 server (no issues):
[root@h2429770 ~]# strings /usr/share/zoneinfo/UTC
TZif2
TZif2
UTC0
[root@h2429770 ~]#

New Centos7 server (with UTC issues):
[root@h2879813 ~]# strings /usr/share/zoneinfo/UTC
TZif2
+0020
+0120
CEST
TZif2
+0020
+0120
CEST
CET-1CEST,M3.5.0,M10.5.0/3

So it looks like the UTC file in /usr/share/zoneinfo/UTC does contain CEST content instead of the expected UTC content.....

I copied the UTC file from my centos6 box to my centos7 box, which solved the issue!!!

Great, thanks for pointing me in the right direction.
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!
 
Last edited:
Back
Top