After researching about the PHP in Travis CI build for the while, it looks like the phpenv doesn’t include the snmp extension by default.
I give up using the phpenv and let sudo be required to try installing the php-7.1 version and snmp on Ubuntu 16.04.
It seems that this can be worked successfully.
Here is my .travis.yml setting.
language: php
sudo: required
php:
- 7.1
before_install:
- sudo apt-get update
- sudo apt-get install -y python-software-properties
- LC_ALL=C.UTF-8 sudo add-apt-repository -y ppa:ondrej/php
- sudo apt-get update
- sudo apt-get install -y apt-transport-https apt-utils curl php7.1-cli php7.1-mysql php7.1-curl php7.1-snmp
script:
- sudo php -m | grep snmp
The related repository is available here.
Here is the Travis CI build log.