Встановлення

PHP 5.3.0, 5.3.1 and 5.3.2 do not have SNMP support. SNMP support has been restored in PHP 5.3.3.

The Windows distribution of Net-SNMP contains support files for SNMP in the mibs directory. This directory should added to Windows' environment variables, as MIBDIRS, with the value being the full path to the mibs directory: e.g. c:\usr\mibs.

Important notes for PHP prior to 5.4.0: In order to use the UCD SNMP package, you need to define NO_ZEROLENGTH_COMMUNITY to 1 before compiling it. After configuring UCD SNMP, edit config.h or acconfig.h and search for NO_ZEROLENGTH_COMMUNITY. Uncomment the #define line. It should look like this afterwards:

#define NO_ZEROLENGTH_COMMUNITY 1
Now compile PHP --with-snmp[=DIR] .

If you see strange segmentation faults in combination with SNMP commands, you did not follow the above instructions. If you do not want to recompile UCD SNMP, you can compile PHP with the --enable-ucd-snmp-hack switch which will work around the misfeature.

add a note add a note

User Contributed Notes 4 notes

up
2
robinson
7 years ago
There is no "mibs" directory in the php package, I check with 5.2,5.4,5.5 and 5.6, none of them has the net-snmp mibs folder.

What you have to do is download the source of net-snmap and copy the folder into your unpacked php folder besides the instructions provided above

net-snmap download link

https://sourceforge.net/projects/net-snmp/files/net-snmp/

after you download, unzip the file and copy folder mibs to your php folder
up
1
Coffee-fan
11 years ago
In order to build and install php in Ubuntu 12.10, beyond the normal "build-essential" package, I had to install the following packages: apache2-prefork-dev  libxml2-dev libsnmp libsnmp-dev libtool

Command line should be like this:

sudo apt-get install apache2-prefork-dev libxml2-dev libsnmp libsnmp-dev libtool
up
-5
Darren Wolfe
11 years ago
If PHP complains that some mibs are missing and they are not included in your windows php package, they can be obtained from the source package of net-snmp itself.
up
-17
bug404 at free dot fr
9 years ago
If net-snmp was not installed in default c:\usr folder (which may be the case for most peoples used to Windows instead of Linux), then, you should also create SNMP_PERSISTENT_DIR system environment variable with "persistent" folder location (located in snmp folder).
Otherwise, php will will create its own persistant folder in c:/usr/snmp/persistent folder, which is probably not what you want !
To Top