PHP SNMP - Cannot Find Module

I turned on the SNMP module trying to execute functions in the module. I set the MIBDIRS environment variable, where I have my mib, but I still get the "Can't find the module" warnings:

Cannot find module (IP-MIB): At line 0 in (none) Cannot find module (IF-MIB): At line 0 in (none) Cannot find module (TCP-MIB): At line 0 in (none) Cannot find module (UDP-MIB): At line 0 in (none) Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none) Cannot find module (SNMPv2-MIB): At line 0 in (none) Cannot find module (SNMPv2-SMI): At line 0 in (none) Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none) Cannot find module (UCD-SNMP-MIB): At line 0 in (none) Cannot find module (UCD-DEMO-MIB): At line 0 in (none) Cannot find module (SNMP-TARGET-MIB): At line 0 in (none) Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none) Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none) Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none) Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none) Cannot find module (UCD-DLMOD-MIB): At line 0 in (none) Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none) Cannot find module (SNMP-MPD-MIB): At line 0 in (none) Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none) Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none) Cannot find module (SNMPv2-TM): At line 0 in (none) 

I know I fixed it once, but I can't fix it again ... what else can I try?

I am on Windows.

+7
source share
8 answers

There are apparently two environment variables that you can set. One of them is MIBDIRS , where all the MIB files are located. The other is MIBS , which I believe is the SNMP module you want to download. By setting MIBS to ALL , I was able to get rid of errors.

+7
source

Open php.ini and add a magic semicolon in the line that looks like this:

 extension=php_snmp.dll 

It should look like this:

 ;extension=php_snmp.dll 
+3
source

In linux, I was able to fix them by adding this to the file / etc / php 5 / apache2 / conf.d / snmp.ini.

mibdir = / usr / shares / SNMP / MIBs
MIBs = all

+3
source

I have the same problem on Ubuntu with php7.1 and the solution installed snmp package

 apt-get install snmp 
+3
source

I just installed it on my machine by adding

 mibdirs +/var/lib/mibs/iana:/var/lib/mibs/ietf 

to /etc/snmp/snmp.conf .

0
source

Faced a similar issue, but in Ubuntu -

In / etc / snmp / snmp.conf -

 # As the snmp packages come without MIB files due to license reasons, loading # of MIBs is disabled by default. If you added the MIBs you can reenable # loading them by commenting out the following line. #mibs : 

So, commenting on the mibs line in this file, she solved it.

0
source

The php package does not include the mibs folder, you need to download the net-snmp source file and copy the folder to your php directory

download link https://sourceforge.net/projects/net-snmp/files/net-snmp/5.7.3/

after that unzip the zip file and copy the mibs folder to the php directory

for exmaple, copy it to C: \ PHP \ Extras \ mibs
Add the new MIBDIRS system variable. Its value should be: C: \ PHP \ Extras \ mibs

Finally, you can run php -m

and you will be reassigned

I am attaching a screenshot for your reference. enter image description here

0
source

Just add the Simple Network Management Protocol (in the Management and Monitoring Tools) from the Windows Component Wizard if you are using Windows. Restart Windows, if necessary, and try again.

-one
source

All Articles