You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently upgraded my server that Histou and Nagios is running on and it went from PHP 7.1 to PHP 8.1
After this I couldn't get histou to work properly so I found this in the logs:
PHP Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead in /usr/local/nagios/share/histou/histou/bootstrap.php on line 17
The __autoload() function in PHP has been removed in PHP 8 and according to the log you should replace it with spl_autoload_register() instead.
After some reading in the PHP documentation I found this to fix it:
Remove this from /usr/local/nagios/share/histou/histou/bootstrap.php:
function __autoload($className) {
$file = strtolower(str_replace('\\', DIRECTORY_SEPARATOR, $className)).'.php';
if (file_exists($file)) {
require_once $file;
}
}
And replace it with this:
function my_autoloader($className) {
$file = strtolower(str_replace('\\', DIRECTORY_SEPARATOR, $className)).'.php';
if (file_exists($file)) {
require_once $file;
}
}
spl_autoload_register('my_autoloader');
I'm not really a developer otherwise I've would have felt comfortable making a PR for this.
If anyone else wants to do it, go ahead.
This solved my issues and I'm hoping it will save someone else some time troubleshooting.
The text was updated successfully, but these errors were encountered:
Hi, I've the same error, but the fix does not work for me. When I try to read data from grafana I've the following error:
"
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 4 passed in /var/www/html/histou/histou/database/jsondatabase.php on line 35 and exactly 5 expected in /var/www/html/histou/index.php:16\nStack trace:\n#0 /var/www/html/histou/histou/database/jsondatabase.php(35): {closure}()\n#1 /var/www/html/histou/histou/database/influxdb.php(32): histou\database\JSONDatabase->__construct()\n#2 /var/www/html/histou/index.php(49): histou\database\Influxdb->__construct()\n#3 {main}\n thrown in /var/www/html/histou/index.php on line 16,
"
Regards
Hi, as a lamentable workaround I can access to the graphs if I delete the code that expects the arguments from /var/www/html/histou/index.php:
"
set_error_handler(
function ($errno, $errstr, $errfile, $errline, array $errcontext) {
// error was suppressed with the @-operator
if (0 === error_reporting()) {
return false;
}
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
);
"
Regards
I recently upgraded my server that Histou and Nagios is running on and it went from PHP 7.1 to PHP 8.1
After this I couldn't get histou to work properly so I found this in the logs:
PHP Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead in /usr/local/nagios/share/histou/histou/bootstrap.php on line 17
The
__autoload()
function in PHP has been removed in PHP 8 and according to the log you should replace it withspl_autoload_register()
instead.After some reading in the PHP documentation I found this to fix it:
Remove this from
/usr/local/nagios/share/histou/histou/bootstrap.php
:And replace it with this:
I'm not really a developer otherwise I've would have felt comfortable making a PR for this.
If anyone else wants to do it, go ahead.
This solved my issues and I'm hoping it will save someone else some time troubleshooting.
The text was updated successfully, but these errors were encountered: