PHP not working in Nagios install

8 posts / 0 new
Last post
#1 Thu, 06/19/2014 - 10:31

PHP not working in Nagios install


I am trying to install Nagios. I have a Centos 6.5 server. I followed this tutorial.

I got as far as logging in past the http authentication, and seeing a welcome page to Nagios, BUT... PHP is not parsing. All PHP is just output to the page.

Does anyone know how I can get PHP working for this?


Thu, 06/19/2014 - 11:24


Are other PHP apps on your server working properly? It's just Nagios that's having this problem?

Also, can you describe how and where you installed Nagios?


Thu, 06/19/2014 - 12:18

Oh yeah...

PHP is fine on the server. We create virtual hosts and add normal PHP CMS sites (e.g. Expression Engine). All works fine.

Looks like I forgot to post the link of the tutorial I followed!

So these commands:

rpm -Uvh
rpm -Uvh
yum -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd
chkconfig httpd on && chkconfig nagios on
service httpd start && service nagios start
Wed, 09/03/2014 - 03:25 (Reply to #3)

And this is why you should not just copy and paste commands without actually knowing what they do. This tutorials do more harm than good. That tutorial probably assumes a clean server, this is why they are installing Apache along side. I'm pretty sure you don't want two different Apache versions running in the same server...

If you are posting in his forums then you probably run Virtualmin and Virtualmin already installed apache for you of is using your existing software. And since you mentioned PHP works fine and other websites, I know for a fact you already have Apache running.

Please check what you posted again. That yum command is installing a RPM called httpd with it, this means you installing another Apache version in your servers. Not only that, you are also installing another PHP with that as well since there is a RPM PHP as well where.

This is why its not working. You don't need that. You are probably overwriting your versions or installing a separate packages that conflicts with Virtualmin.

All this tutorials on Digital Ocean are for NEW droplets. This means clean servers with no previous data on them. In this case, the user is using just one single droplet for Nagios and he runs Nagios alone and nothing more in that CentOS server.

Why? Because why in the world would you install a monitoring server in the same server you are hosting websites? Nagios is very intensive. That is something dumb to do, you don't want that. Just launch a new droplet in Digital Ocean just for Nagios and follow that tutorial again.

Also, some of those tutorials are really bad, in terms of security or suggestions. Digital Ocean pays users for sending tutorials so they are very short, badly made and mostly copied. I would advice anyone to seriously read them only if you already know a bit around Linux and like I said, they all assume you are using a new clean droplet.

Wed, 09/03/2014 - 11:57 (Reply to #4)

We have to learn somewhere in the absence of install instructions for Nagios within a Virtualmin server. Errors will occur, we turn to forums.

A second httpd and php is not the issue. In fact, yum would not overwrite or install second versions but say they are already installed. It was because PHP could not be executed outside of /home is the issue. So what I need is Nagios install instructions into a virtual server in the /home directory which Virtualmin uses. Probably just Nagios configs/paths need changing.

Because I could not get it to work, my Nagios server is Ubuntu without Virtualmin at the moment.

Also, I am not hosting websites on the Nagios server. I merely want Virtualmin/Webmin to be the management system of the Nagios server because Virtualmin/Webmin rock.

Thu, 06/19/2014 - 22:56


Ah, okay, that helps... so here is the trouble that I suspect you're having.

When using RPM packages like that, the PHP files are likely being installed into /usr, or perhaps /var.

However, your system has been configured to execute PHP files out of /home, and typically, trying to run PHP from alternate locations won't work properly.

Is it an option to move the PHP files you have into a Virtual Server that uses a DocumentRoot within /home? If so, that would likely resolve the issue you're seeing.


Fri, 06/20/2014 - 03:04

Ah right, OK thanks Eric.

I am not sure what that involves, moving the files. i.e. will it still run as a service?

Is it possible to change it to execute files elsewhere?

I am not sure I will go with Nagios anyway, as I tried it on a new Ubuntu VM I fired up and its not very good to be honest (dont know why everyone raves about it). But there are other systems that install via rpm so be good to know how to resolve this issue anyway.


Fri, 06/20/2014 - 10:24

I believe there should be some .php files, just from the frontend of Nagios.

You wouldn't be moving the daemon itself, just the files that generate the web frontend to it.

For some other things to look at --

Webmin itself can do monitoring. You can set that up in Webmin -> Others -> System and Server Status.

Also, I've had some luck with the tool "monit".

There's of course plenty of others as well... good luck in your hunt!


Topic locked