Hello,
I am migrating an application from PHP 7.2 to PHP 8. (RHEL 7 to RHEL 9)
In PHP 7.2 this works:
<?php
$host = "10.0.1.4";
$com = "redacted";
$oid = "ipRouteMask";
if ($arry = snmprealwalk ($host, $com, $oid)) {
} else {
echo "Error, could not retrieve a list of routes from $host.";
die();
}
$host = "10.0.1.4";
$com = "redacted";
$oid = "ipRouteMask";
if ($arry = snmprealwalk ($host, $com, $oid)) {
} else {
echo "Error, could not retrieve a list of routes from $host.";
die();
}
In PHP 8 it says:
PHP Warning: snmprealwalk(): Invalid object identifier: ipRouteMask
If I add snmp_read_mib('/usr/share/snmp/mibs/RFC1213-MIB.txt'); the code works normally but we use more than 110 MIB files across dozens of separate scripts.
I tried setting this environment variable MIBDIRS=/usr/share/snmp/mibs that seems to do nothing even in php-cli.
Does anyone know how to configure PHP to use the mibdir (or make it work like it did in PHP 7?)
thank you.