Page 1 of 1

System time and php time are not matching

Posted: Thu Aug 29, 2013 2:37 am
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

Re: System time and php time are not matching

Posted: Thu Aug 29, 2013 9:54 am
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/

Re: System time and php time are not matching

Posted: Mon Sep 02, 2013 2:15 am
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

Re: System time and php time are not matching

Posted: Tue Sep 03, 2013 10:30 am
by abrist
Did you change the clock settings as well?
http://assets.nagios.com/downloads/nagi ... m_Time.pdf

Re: System time and php time are not matching

Posted: Mon Sep 23, 2013 2:34 am
by INFINITT
Hi,

yes. I already changed the Zone to ZONE="Europe/Berlin" but still the same issue. (Time difference +2 h)

Re: System time and php time are not matching

Posted: Mon Sep 23, 2013 10:05 am
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