©
本文档使用 PHP中文网手册 发布
重要提示:为了使用 UCD SNMP 包,需要在编译之前将 NO_ZEROLENGTH_COMMUNITY 定义为 1。 在配置 UCD SNMP 之后,编辑 config.h 或 acconfig.h,查找 NO_ZEROLENGTH_COMMUNITY,将 #define 所在行的注释去掉。修改后应该类似这样:
#define NO_ZEROLENGTH_COMMUNITY 1
如果在组合 SNMP 命令时看到奇怪的字段错误,那就是因为没有遵从上述说明。如果不想重新编译 UCD SNMP,可以使用 --enable-ucd-snmp-hack 开关编译 PHP 以绕开上述错误。
Windows 版本在目录 mibs 中包含了支持 SNMP 的文件。此目录应该移到 DRIVE:\usr\mibs,其中 DRIVE 是安装 PHP 所在的盘符,例如 c:\usr\mibs。
[#1] bug404 at free dot fr [2014-09-07 17:00:27]
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 !
[#2] Coffee-fan [2013-02-14 05:35:28]
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
[#3] Darren Wolfe [2012-06-04 13:18:06]
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.
[#4] flintjt att hotmail dot com [2011-04-04 14:23:01]
For win32 (tested on win XP and 2k3 server 32bit):
Tested with versions 5.3.3 VC9, and 5.3.6 VC9.
The php_snmp.dll, requires that you set the environment variable MIBDIRS pointed to your MIBs folder.