PHP Warning: strftime() & simplexml errors

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sheld0r
Posts: 49
Joined: Thu Jan 03, 2013 5:39 pm

PHP Warning: strftime() & simplexml errors

Post 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.
sheld0r
Posts: 49
Joined: Thu Jan 03, 2013 5:39 pm

Re: PHP Warning: strftime() & simplexml errors

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: PHP Warning: strftime() & simplexml errors

Post 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?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sheld0r
Posts: 49
Joined: Thu Jan 03, 2013 5:39 pm

Re: PHP Warning: strftime() & simplexml errors

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: PHP Warning: strftime() & simplexml errors

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sheld0r
Posts: 49
Joined: Thu Jan 03, 2013 5:39 pm

Re: PHP Warning: strftime() & simplexml errors

Post by sheld0r »

I'm sorry, maybe I'm missing something but aren't those the exact same? Do I need to add quotes?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: PHP Warning: strftime() & simplexml errors

Post by abrist »

The_difference_is_an_underscore_ - " _ "
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.
sheld0r
Posts: 49
Joined: Thu Jan 03, 2013 5:39 pm

Re: PHP Warning: strftime() & simplexml errors

Post 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!
sheld0r
Posts: 49
Joined: Thu Jan 03, 2013 5:39 pm

Re: PHP Warning: strftime() & simplexml errors

Post by sheld0r »

Ah looks like you're on the list too abrist. I'll be sure to bring my reading glasses :P
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: PHP Warning: strftime() & simplexml errors

Post by yancy »

Thanks sheld0r,

Marking the ticket as solved.

-Yancy
Locked