Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
jorgembferreira
Posts: 2
Joined: Sat Apr 26, 2025 10:27 am

Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9

Post by jorgembferreira »

Thanks @MortenSickel

Like other said your solution fixed it partially for me.
The "Home" page is completely blank, but the rest of the webpages "Services", "Hosts", etc. all are accessible again. There is any fix for HomePage?
The error in log is:
PHP Parse error: syntax error, unexpected '?' in /usr/local/nagios/share/main.php on line 6, referer: side.php

Notice also that index.php have also entries with Null coalescing "bug", mabe this should be also be fixed on Core
jorgembferreira
Posts: 2
Joined: Sat Apr 26, 2025 10:27 am

Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9

Post by jorgembferreira »

Thanks @MortenSickel !

Nice solution.
However the "Home" page still blank, but the rest of the webpages "Services", "Hosts", etc. all are accessible again.
Everytime hit Home link, i've got in log:
PHP Parse error: syntax error, unexpected '?' in /usr/local/nagios/share/main.php on line 6, referer: side.php
Anyway that Home can ve back to live?


And for what I see there is also Null coalescing stuff in index.php file.

MortenSickel wrote: Tue Jan 21, 2025 7:18 am I had the same problem the other day. The php code demands a newer version of php than what your server is running. It is using the Null coalescing ?? operator

Code: Select all

 $theme = $cfg['theme'] ?? 'dark';
 if ($theme != 'dark' && $theme != 'light') {
          $theme = 'dark';
  }
I.e. if $cfg['theme'] is set. $theme is set to that value, if it is not set, $theme is set to 'dark'

I did a quite ugly hack,

Code: Select all

//$theme = $cfg['theme'] ?? 'dark';
$theme = '';
if ($theme != 'dark' && $theme != 'light') {
         $theme = 'dark';
}
This is hardcoding theme to dark. I could have written a few lines to get the same function as originally, but I didn't bother. The same operator is used a few other places in the code base to do exactly the same thing, so expect the same error to pop up a few more things or grep for ?? (ie grep \?\? *php) to correct them all.
Post Reply