Getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/share/nagios2/htdocs/nagiosweb/hostlist.php on line 13
I'm trying to install and get it running on Ubuntu/Debian with Apache/2.0.55, PHP/5.1.6, mod_ssl/2.0.55 OpenSSL/0.9.8b Server. Nagios was installed using the "nagios2" package and is running A-OK! the "nagiosweb" database is created and the mysql user is permissioned. There were absolutely no errors generated when running the nagiosweb.sql script. PHP is running as a module.
This is my dbconfig.php:
// Database connectivity
$db = mysql_connect("localhost", "mysql", "mysql");
// $prefix is the path to where nagios is installed
$etcprefix = $prefix;
// Path to htdocs directory
// Full path to php binary, include php
// Hostname of your nagios server i.e. nagios.yourname.com
// Administrator Contact Info
// Attempt at removing global_variables requirement
I have verified that "register_globals = On" is present in php.ini. I am not sure how or when this setting is invoked, so as a precaution I forced a restart of apache2 and still got same error. I looked at the previous threads talking about my error and I got nowhere (the problem didn't seem to be with the PRIMARY KEY directives).
I'm not entirely sure about the various paths in the above file. I assume $prefix should be the path to the .cfg files. The nagios2 binary executable is in /usr/sbin, but the cfg files are in the path noted above. The php binary executable is in /usr/sbin, however the php.ini file resides in /etc/php5/apache2.
I'm guessing the .sql import didn't work as well as you thought. One test you can run is use your favorite mysql query analyzer and run:
SELECT host_id, host_name, alias, address FROM hosts ORDER BY host_name
That's exactly what line 13 is trying to do.
Actually, I'm retarded -- the README doc refers to the SQL DB as "nagiosweb-dist" and the default dbconfig.php refers to "nagiosweb". As soon as I noticed and corrected that, all was a-ok!