Raw PHP being displayed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
markmerchant
Posts: 65
Joined: Tue Oct 17, 2017 8:38 am

Raw PHP being displayed

Post by markmerchant »

Problem:
My dev server is behaving oddly. I haven't logged in a couple of months, but
last time it was working well. Now however, raw PHP is being displayed instead
of any Nagios pages.

Could this have been broken by OS updates? My prod servers are not affected.
Can you give me a hint on where to start looking? httpd.conf doesn't appear
to have been changed.

Are the logs on the Nagios side I could look in?

Thx.

Example:

Code: Select all

	<?php ?><?php // Copyright (c) 2008-2017 Nagios Enterprises, LLC. All rights
	reserved. ?><?php
	if(!function_exists('sg_load')){$__v=phpversion();$__x=explode('.',$__v);$__v2=$__x[0].'.'.(int)$__x[1];$__u=strtolower(substr(php_uname(),0,3));$__ts=(@constant('PHP_ZTS')
	||
	@constant('ZEND_THREAD_SAFE')?'ts':'');$__f=$__f0='ixed.'.$__v2.$__ts.'.'.$__u;$__ff=$__ff0='ixed.'.$__v2.'.'.(int)$__x[2].$__ts.'.'.$__u;$__ed=@ini_get('extension_dir');$__e=$__e0=@realpath($__ed);$__dl=function_exists('dl')
	&& function_exists('file_exists') && @ini_get('enable_dl') &&
	!@ini_get('safe_mode');if($__dl && $__e && version_compare($__v,'5.2.5'
Version:
Nagios XI 5.4.10
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Raw PHP being displayed

Post by npolovenko »

Have you updated php recently? Could you still upload the following file so I could take a look?
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/php.conf
Take a look at the logs in the /var/log/httpd/ folder, such as error_log or ssl_error_log.

Finally, please show the output of this command:
yum list installed | grep php
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
markmerchant
Posts: 65
Joined: Tue Oct 17, 2017 8:38 am

Re: Raw PHP being displayed

Post by markmerchant »

Thx. I think this is it. Will have to recover from backups.

Code: Select all

ls -la /etc/httpd/conf.d/php.conf
    ls: cannot access /etc/httpd/conf.d/php.conf: No such file or directory
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Raw PHP being displayed

Post by npolovenko »

@markmerchant, My server is on CentOS. If you're on another OS this file could be in a different location. You can search the filesystem with:
find / -name php.conf
I agree. If you have any recent XI backups you could do the restore to quickly fix the issue.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Raw PHP being displayed

Post by benjaminsmith »

Hi Mark,

Just following up with you on this issue. Were you able to re-store the conf file from a backup. Let us know if you got it resolved.

Thanks.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked