Page 1 of 1

Raw PHP being displayed

Posted: Mon Jan 28, 2019 1:28 pm
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

Re: Raw PHP being displayed

Posted: Mon Jan 28, 2019 1:36 pm
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

Re: Raw PHP being displayed

Posted: Mon Jan 28, 2019 2:21 pm
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

Re: Raw PHP being displayed

Posted: Mon Jan 28, 2019 2:38 pm
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

Re: Raw PHP being displayed

Posted: Thu Feb 07, 2019 12:11 pm
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.