PHP Warning: feof() expects parameter 1 to be resource

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jbaduria
Posts: 3
Joined: Tue Jul 07, 2020 12:01 pm

PHP Warning: feof() expects parameter 1 to be resource

Post by jbaduria »

PHP Warning: feof() expects parameter 1 to be resource, boolean given in /usr/local/nagiosxi/scripts/utils-reports.inc.php

It is on line 578:

$fp = popen($binpath, "r");
while (!feof($fp)) { --- Line 578
$rawoutput .= fread($fp, 1024);
}

I think it needs to check for $fp:

$fp = popen($binpath, "r");
if ($fp) {
while (!feof($fp)) {
$rawoutput .= fread($fp, 1024);
}
}
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: PHP Warning: feof() expects parameter 1 to be resource

Post by dchurch »

Sure, that's a good fix. I'll notify our dev team.

If you're interested in remedying the cause of this error, then read on.

What's the output from the following commands?

Code: Select all

ls -la /usr/local/nagios/sbin/avail.cgi
php -r 'require("/usr/local/nagiosxi/html/config.inc.php");var_dump($cfg["component_info"]["nagioscore"]["cgi_dir"]);'
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Locked