Page 1 of 1

PHP Warning: strftime() & simplexml errors

Posted: Mon Jul 29, 2013 3:26 pm
by sheld0r
My logs continue to fill up on my Nagios server. So I ran a tail -f /var/log/httpd/error_log to see what was the culprit. I'm getting a tone of the following two error messages.

Code: Select all

[error] [client 192.168.110.49] 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/Los_Angeles' for 'PDT/-7.0/DST' instead in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 381, referer: http://192.168.100.77/nagiosxi/includes/components/xicore/tac.php

Code: Select all

[error] [client 192.168.110.96] PHP Warning:  simplexml_load_string(): Entity: line 2: parser error : Start tag expected, '<' not found in /usr/local/nagiosxi/html/includes/utils-backend.inc.php on line 27, referer: http://192.168.100.77/nagiosxi/includes/components/xicore/status.php?show=process

So this is what I've done so far to verify and troubleshoot (for error #1). I have no idea what is causing the second error message. IP address x.x.110.49 and x.x.110.96 are workstations connecting to the Nagios XI GUI.

-I've verified that the settings in /etc/php/php.ini for the timezone is correct.
-Verified the date and time is correct on the CentOS server.

Re: PHP Warning: strftime() & simplexml errors

Posted: Mon Jul 29, 2013 4:18 pm
by sheld0r
I've also noticed that my Host Status Summary and Service Status Summary show 0 across the board, except for UP under Host Status Summary. Does this have anything to do with that second error? If not, I can open a separate thread for that issue.

Re: PHP Warning: strftime() & simplexml errors

Posted: Mon Jul 29, 2013 7:28 pm
by scottwilkerson
sheld0r wrote:I've verified that the settings in /etc/php/php.ini for the timezone is correct.
Are you sure the line isn't commented out in the file?

Did you restart apache after making the change?

Code: Select all

service httpd restart
The second error is usually caused by output being created before the backend returns the XML.

Have you added/modified any components/dashlets or updated /usr/local/nagiosxi/html/config.inc.php recently?

Re: PHP Warning: strftime() & simplexml errors

Posted: Tue Jul 30, 2013 12:25 pm
by sheld0r

Code: Select all

;;;;;;;;;;;;;;;;;;;
Module Settings ;
;;;;;;;;;;;;;;;;;;;
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = America/Los Angeles
Here's what I got in my config.

I've made no changes to the components/dashlets, and no updates were performed. That's why I find it so odd that it's not working. Quite frankly, I've neglected the server and came back to it to finely tune it.

Re: PHP Warning: strftime() & simplexml errors

Posted: Tue Jul 30, 2013 12:50 pm
by scottwilkerson
sheld0r wrote:

Code: Select all

;;;;;;;;;;;;;;;;;;;
Module Settings ;
;;;;;;;;;;;;;;;;;;;
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = America/Los Angeles
Here's what I got in my config.

I've made no changes to the components/dashlets, and no updates were performed. That's why I find it so odd that it's not working. Quite frankly, I've neglected the server and came back to it to finely tune it.
This is not valid, change

Code: Select all

date.timezone = America/Los Angeles
to

Code: Select all

date.timezone = America/Los_Angeles
then restart apache

Code: Select all

service httpd restart

Re: PHP Warning: strftime() & simplexml errors

Posted: Tue Jul 30, 2013 1:00 pm
by sheld0r
I'm sorry, maybe I'm missing something but aren't those the exact same? Do I need to add quotes?

Re: PHP Warning: strftime() & simplexml errors

Posted: Tue Jul 30, 2013 3:23 pm
by abrist
The_difference_is_an_underscore_ - " _ "

Re: PHP Warning: strftime() & simplexml errors

Posted: Tue Jul 30, 2013 4:18 pm
by sheld0r
So you might think I'm dumb and blind, but I really didn't see the underscore. I'm using Chrome as my browser. Here is a screenshot. If I quote his post, I can see the underscore. Weird.

[img=http://s24.postimg.org/6kqjdjijl/Capture_Nagios_Error.jpg]

That did the trick though, those errors are now gone.

Thanks for the help!

@ scottwilkerson
I look forward to hearing you speak at the Nagios Conference this year. I'll be there!

Re: PHP Warning: strftime() & simplexml errors

Posted: Tue Jul 30, 2013 4:25 pm
by sheld0r
Ah looks like you're on the list too abrist. I'll be sure to bring my reading glasses :P

Re: PHP Warning: strftime() & simplexml errors

Posted: Tue Jul 30, 2013 4:57 pm
by yancy
Thanks sheld0r,

Marking the ticket as solved.

-Yancy