Page 1 of 2
date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 8:37 am
by eloyd
A customer of ours is in in the process of moving from an old Nagios 2014 server to a new Nagios 5.4 server. Rather than upgrade the old one 29 times, we decided to install a new one and migrate data and scripts. From a Nagios functionality perspective, everything is fine.
However, we're seeing something in the Apache error_log that looks like this (redacted):
Code: Select all
[Thu Jul 13 10:47:35 2017] [error] [client 167.13.14.7] PHP Warning: strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 581, referer: http://al-nyny-nagios1.nybcs.bcs.pvt/nagiosxi/includes/components/xicore/status.php?show=hostdetail&host=Ugw-8908+-+GFX
So I thought "okay, /etc/php.ini must need to be updated for the common date.timezone issue." Except, /etc/php.ini already has date.timezone = America/New_York set, so that's not the problem. And since the PHP obfuscation code is in place in the file listed in the error, I can't get a better look at what's going on.
I'm hoping someone here can tell me what's going on, instead.
Re: date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 11:18 am
by lmiltchev
What is the output of the following two commands?
This may sound lame, but... have you tried restarting apache or/and the server to see if this is going to fix the issue?
Re: date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 12:12 pm
by eloyd
Don't have access to the machine directly, so I'll have to ask the customer to relay the output of those commands.
Yes, Apache was restarted because it was dumping so much to /var/log/httpd/error_log that disk space was filling up. We sent ErrorLog to /dev/null.
Re: date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 12:31 pm
by lmiltchev
Sounds good, eloyd! Post the output of those commands whenever you have it, and ask the customer to restart the server (if possible) to see if this is going to fix the issue.
Re: date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 12:48 pm
by eloyd
Server was restarted a couple times for other reasons; no effect.
Code: Select all
# date
Fri Jul 14 13:36:37 EDT 2017
Code: Select all
strings /etc/localtime
TZif2
6`/~Kp0
`1gg
`3GI
`5'+
pCda`D/vpEDC`E
@`M|kpN
"`O\MpP
`Q</pRu
k`b-
pcgM`d
xpeG/`e
Zpg'
<`|~gp}
`~^Ip
TZif2
/~Kp
Cda`
D/vp
EDC`
M|kp
O\Mp
Q</p
cgM`
eG/`
|~gp
~^Ip
EST5EDT,M3.2.0,M11.1.0
Re: date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 2:03 pm
by lmiltchev
This is very strange issue indeed... Let's run a few more commands, and see the output. I will try to recreate the issue in-house.
Code: Select all
uname -a
cat /etc/*release
grep full /usr/local/nagiosxi/var/xiversion
grep "date.timezone =" /etc/php.ini
cat /etc/sysconfig/clock
ls -l /etc/localtime
rpm -qa | grep tzdata
Re: date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 2:35 pm
by eloyd
Yes. So strange that I have to ask for forum help.
Code: Select all
[root@AL-NYNY-NAGIOS1 ~]# uname -a
Linux AL-NYNY-NAGIOS1.nybcs.bcs.pvt 2.6.32-431.23.3.el6.x86_64 #1 SMP Wed Jul 16 06:12:23 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@AL-NYNY-NAGIOS1 ~]# cat /etc/*release
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@AL-NYNY-NAGIOS1 ~]# grep full /usr/local/nagiosxi/var/xiversion
full=5.4.5
[root@AL-NYNY-NAGIOS1 ~]# grep "date.timezone =" /etc/php.ini
date.timezone = America/New York
[root@AL-NYNY-NAGIOS1 ~]# cat /etc/sysconfig/clock
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE="America/New York"
[root@AL-NYNY-NAGIOS1 ~]# ls -l /etc/localtime
-rw-r--r--. 1 root root 3519 May 4 2010 /etc/localtime
[root@AL-NYNY-NAGIOS1 ~]# rpm -qa | grep tzdata
tzdata-java-2014e-1.el6.noarch
tzdata-2017b-1.el6.noarch
Re: date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 3:06 pm
by lmiltchev
Is this a typo?
It should be:
Same in /etc/sysconfig/clock...
Re: date.timezone problems, but not in /etc/php.ini
Posted: Fri Jul 14, 2017 9:37 pm
by eloyd
And this is why we need more eyes.
Customer made the change, but I won't know until Monday if it fixed it.
Re: date.timezone problems, but not in /etc/php.ini
Posted: Mon Jul 17, 2017 9:02 am
by lmiltchev
"More eyes" is always better.

Let us know if the issue has been resolved.