System time and php time are not matching

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
INFINITT
Posts: 3
Joined: Wed May 15, 2013 8:38 am
Location: Frankfurt, Germany
Contact:

System time and php time are not matching

Post by INFINITT »

Hi,

I know this topic is allready discussed but I can't install NTP on my Nagios Server so I need an another way for fixing this issue. :(

As you can see in the attached image my systemtime and my timezone are correct. But you also can see the differnce between the systemtime and the PHP time.
Europe/Berlin is +1 (GMT).

Due this issue I am getting eMails and reports from the future. :P

Where can I set the GMT?
Where or how can I set the PHP time?
Or is there a way to syncronize both times?

Thanks a lot for your help and support in advance :D
You do not have the required permissions to view the files attached to this post.
:D Nagsios XI newbie :D
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: System time and php time are not matching

Post by slansing »

We can certainly help can you please run the following?:

Code: Select all

date

Code: Select all

grep date.timezone /etc/php.ini
And send us the output?

The best way to sync is with ntp, however you can change the timezones in several other places.

This is a good, short guide to changing your system time:

http://www.timgalyean.com/posts/to-chan ... me-centos/
INFINITT
Posts: 3
Joined: Wed May 15, 2013 8:38 am
Location: Frankfurt, Germany
Contact:

Re: System time and php time are not matching

Post by INFINITT »

Hi,

at first THX for your help.

After chaniging my system time like this:

[root@localhost ~]# date
Mon Sep 2 08:52:41 EDT 2013
[root@localhost ~]# cp /etc/localtime /etc/lokaltime.bak
[root@localhost ~]# rm -f /etc/localtime
[root@localhost ~]# ln -s /usr/share/zoneinfo/europe/berlin /etc/localtime
[root@localhost ~]# date
Mon Sep 2 12:54:21 UTC 2013


my output for
date is:

[root@localhost ~]# date
Mon Sep 2 12:54:21 UTC 2013


and the putput for
grep date.timezone /etc/php.ini is:

[root@localhost ~]# grep date.timezone /etc/php.ini
; http://www.php.net/manual/en/datetime.c ... e.timezone
; date.timezone = America/New_York
date.timezone = Europe/Berlin


I've already tried to change my PHP Time but nevertheless the difference between the PHP-Time and the system time are 2h.

Thx in advance for your support :D
You do not have the required permissions to view the files attached to this post.
:D Nagsios XI newbie :D
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: System time and php time are not matching

Post by abrist »

Did you change the clock settings as well?
http://assets.nagios.com/downloads/nagi ... m_Time.pdf
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
INFINITT
Posts: 3
Joined: Wed May 15, 2013 8:38 am
Location: Frankfurt, Germany
Contact:

Re: System time and php time are not matching

Post by INFINITT »

Hi,

yes. I already changed the Zone to ZONE="Europe/Berlin" but still the same issue. (Time difference +2 h)
:D Nagsios XI newbie :D
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: System time and php time are not matching

Post by abrist »

This is odd. Are you sure those files are different?

Code: Select all

diff /usr/share/zoneinfo/Europe/Berlin /usr/share/zoneinfo/UTC
ls -la /usr/share/zoneinfo/Europe/Berlin
ls -la /etc/localtime
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked