Helping you solve those tough coding problems!

Cannot find module (SNMPv2-TC) Cannot find module (SNMPv2-TC)

Published on Feb 18, 2019 by Jamie Munro

When I run PHP via the command line (aka php cli), I often would be spammed with the following error messages:
Cannot find module (SNMPv2-TC)
Cannot find module (SNMPv2-SMI)

Messages like this would repeat for 30 or 40 lines. These errors would not stop my command from executing; however, it was extremely noisy when trying to see the output.

How to fix Cannot find module (SNMPv2-TC) and (SNMPv2-SMI)

Some command examples I would run would be:
php myfile.php

Or when I would run CakePHP console commands:
/mycakephpapp/app/Console/cake mycakephpcommand

To resolve this problem I simply removed the following package: php5-snmp using the following command:
sudo apt-get remove php5-snmp

The above snippet is for php5, if you are using php7, it would be:
sudo apt-get remove php7.0-snmp

Be careful before removing packages to ensure your application doesn't use them. In my case I was not using this package and removing it reduced all of the errors when running PHP via the command line.

Tags: CakePHP | PHP

My Books