Server time not using right timezone

Zoop

Member
Feb 15, 2016
13
2
3
Netherlands
cPanel Access Level
Root Administrator
Hello folks,

Ive got an issue and it's driving me crazy. We've got several CPanel servers and they are pretty much configured the same way.

One of the servers seems to have an incorrect time/timezone configuration, as date functions in php are always off by 2 or 3 hours.

When I look at the Server Time option in WHM is see this:

Fri Aug 5 16:03:08 GMT-2 2016
Configure Timezone
Europe/Amsterdam Change Timezone

So it is set to Europe/Amsterdam timezone, which should be CEST or GMT+1. When I look at the same thing on another server, it nicely says its using CEST timezone (and thus has correct times).

Resyncing it, or changing the timezone has no effect.

Why is my server using GMT-2 on this timezone? Thats completely incorrect, and im at a loss where to look. Any suggestions? Thanks
 

Zoop

Member
Feb 15, 2016
13
2
3
Netherlands
cPanel Access Level
Root Administrator
No its not, not at all. Im saying the steps described in that document wont work. Changing the timezone does not correct it, nordoes doing it by commandline.

Even though the timezone is set to Europe/Amsterdam, it shows GMT-2 on the same screen, thats simply not correct.
Changing it to another timezone and back does not help either. Syncing with server als doesnt help.Schermafbeelding 2016-08-12 om 15.16.34.png
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
Hello,

Please post the output from the following command in order to verify the server environment this is happening on:

Code:
grep '' /etc/redhat-release /usr/local/cpanel/version /var/cpanel/envtype
I've seen this behavior on VPS environments in the past, as it's a limitation of the VPS software used on the main server node.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463

Zoop

Member
Feb 15, 2016
13
2
3
Netherlands
cPanel Access Level
Root Administrator
My VPS provider forwarded me to set up ntpd, which i did. After completing the steps and running the 'date' command from terminal, i get a proper response:
Mon Aug 22 11:09:07 CEST 2016
Meaning, its something i had to do myself, it wasnt something for my VPS provider to do, so why did you ask me to contact my provider?

Testing it in PHP by var_dumping a datetime object without setting any timezones also gives the proper time. However, the situtation in screenshot i attached earlier is still present. It still shows GMT-2 there, while it should be either CEST (like my other Cpanel server shows) or GMT+2 / UTC-1

While i certainly got progress because it shows correctly in the scripts now, but its strange the config still shows it wrong.
This is a complete CentOS+Cpanel installation (supposed to work out of the box, right?), the same as 3 other servers we own, but this is the only one that has these problems.

Why is this happening? And why do i need to set up NTPD while i never did such thing on the other servers?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
My VPS provider forwarded me to set up ntpd, which i did. After completing the steps and running the 'date' command from terminal, i get a proper response:

Mon Aug 22 11:09:07 CEST 2016

Meaning, its something i had to do myself, it wasnt something for my VPS provider to do, so why did you ask me to contact my provider?
I'm happy to see you were able to partly address the issue. VPS providers generally have more information about the specific environment used to host your VPS, so it's a good idea to consult with a VPS provider for an issue like this.

Testing it in PHP by var_dumping a datetime object without setting any timezones also gives the proper time. However, the situtation in screenshot i attached earlier is still present. It still shows GMT-2 there, while it should be either CEST (like my other Cpanel server shows) or GMT+2 / UTC-1
Could you verify if /etc/sysconfig/clock exists on this system, and if so, let us know the contents of that file?

Thank you.