PHP and system time are different

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
benningtonr
Posts: 524
Joined: Tue May 22, 2012 2:16 pm

PHP and system time are different

Post by benningtonr »

I have tried setting the local time as described in a few topic here, but it still says UTC, no NewYork time
[root@nagios ~]# date
Mon Apr 15 17:08:22 UTC 2013
[root@nagios ~]#


PHP time and time zone are correct, just system time is wrong.


Thanks for any available advice

Oh I tried:
[root@nagios ~]# mv /etc/localtime /etc/localtime.bak
mv: overwrite `/etc/localtime.bak'?
[root@nagios ~]# ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
ln: creating symbolic link `/etc/localtime': File exists

I rebooted and still UTC
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: PHP and system time are different

Post by sreinhardt »

Are you able to use ntp on your network? If so this article would be very helpful. Otherwise, let's check where /etc/localtime is pointed presently.

ll /etc/localtime

Another link that might be of interest http://www.linuxsa.org.au/tips/time.html
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
benningtonr
Posts: 524
Joined: Tue May 22, 2012 2:16 pm

Re: PHP and system time are different

Post by benningtonr »

I have NTP setup, and the time is still wrong.

[root@nagios mail]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
192.168.98.10 .STEP. 1 u 44 64 7 0.384 9.370 6.278
bindcat.fhsu.ed .STEP. 16 u - 64 0 0.000 0.000 0.000
kapu.skafari.co .STEP. 16 u - 64 0 0.000 0.000 0.000
services.quadra 216.218.192.202 2 u 54 64 3 77.256 -19.120 4.478
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: PHP and system time are different

Post by abrist »

I just updated the time/zoneinfo document a few days ago. This should cover configuring the system zone and time, as well as ntp:
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.
benningtonr
Posts: 524
Joined: Tue May 22, 2012 2:16 pm

Re: PHP and system time are different

Post by benningtonr »

Times are all set.

One question though, if from the CLI i type date, i get the correct time, but if I type clock, i get utc still.
My graphs are correct so it is not a problem, but I am curious.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: PHP and system time are different

Post by slansing »

I believe clock uses your hardware clock's time, that would be the only difference I can think of.
benningtonr
Posts: 524
Joined: Tue May 22, 2012 2:16 pm

Re: PHP and system time are different

Post by benningtonr »

ok sounds reasonable

Thanks
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: PHP and system time are different

Post by slansing »

Closing as resolved.
Locked