在命令行上运行PHP引发关于SNMP的模块错误

当我在命令行上使用PHP运行任何命令时,我得到一堆关于模块的错误:

vagrant@vagrant-ubuntu-trusty-64:~$ php -v MIB search path: /home/vagrant/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp Cannot find module (SNMPv2-TC): At line 10 in /usr/share/snmp/mibs/UCD-DLMOD-MIB.txt Cannot find module (SNMPv2-SMI): At line 34 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt Cannot find module (SNMPv2-TC): At line 37 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt Did not find 'enterprises' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt) Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt) Did not find 'TruthValue' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt) Unlinked OID in UCD-SNMP-MIB: ucdavis ::= { enterprises 2021 } Undefined identifier: enterprises near line 39 of /usr/share/snmp/mibs/UCD-SNMP-MIB.txt Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/UCD-DLMOD-MIB.txt) Did not find 'ucdExperimental' in module UCD-SNMP-MIB (/usr/share/snmp/mibs/UCD-DLMOD-MIB.txt) Unlinked OID in UCD-DLMOD-MIB: ucdDlmodMIB ::= { ucdExperimental 14 } Undefined identifier: ucdExperimental near line 13 of /usr/share/snmp/mibs/UCD-DLMOD-MIB.txt Cannot find module (MTA-MIB): At line 1 in (none) Cannot find module (NETWORK-SERVICES-MIB): At line 1 in (none) Cannot find module (SNMPv2-TC): At line 15 in /usr/share/snmp/mibs/UCD-DISKIO-MIB.txt Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/UCD-DISKIO-MIB.txt) Did not find 'ucdExperimental' in module UCD-SNMP-MIB (/usr/share/snmp/mibs/UCD-DISKIO-MIB.txt) Unlinked OID in UCD-DISKIO-MIB: ucdDiskIOMIB ::= { ucdExperimental 15 } Undefined identifier: ucdExperimental near line 19 of /usr/share/snmp/mibs/UCD-DISKIO-MIB.txt Cannot find module (SNMPv2-TC): At line 15 in /usr/share/snmp/mibs/LM-SENSORS-MIB.txt Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/LM-SENSORS-MIB.txt) Did not find 'ucdExperimental' in module UCD-SNMP-MIB (/usr/share/snmp/mibs/LM-SENSORS-MIB.txt) Unlinked OID in LM-SENSORS-MIB: lmSensors ::= { ucdExperimental 16 } Undefined identifier: ucdExperimental near line 32 of /usr/share/snmp/mibs/LM-SENSORS-MIB.txt Cannot find module (HOST-RESOURCES-MIB): At line 1 in (none) Cannot find module (HOST-RESOURCES-TYPES): At line 1 in (none) Cannot find module (SNMPv2-MIB): At line 1 in (none) Cannot find module (IF-MIB): At line 1 in (none) Cannot find module (IP-MIB): At line 1 in (none) Cannot find module (TCP-MIB): At line 1 in (none) Cannot find module (UDP-MIB): At line 1 in (none) Cannot find module (NOTIFICATION-LOG-MIB): At line 1 in (none) Cannot find module (DISMAN-EVENT-MIB): At line 1 in (none) Cannot find module (DISMAN-SCHEDULE-MIB): At line 1 in (none) 

这只是一个例子。 为什么不能find模块? 我假设这是所有信息的过程。

只需删除php5-snmp包。 您可以在控制台中使用此命令来执行此操作:

 sudo apt-get remove php5-snmp 
  • 从谷歌search: php UCD-SNMP-MIB.txt
  • 第一个结果: https : //stackoverflow.com/questions/21257589/ubuntu-typing-php-in-terminal-shows-a-lot-of-errors