Installing the Mongo PHP extension on the latest cPanel version is a snap!
cPanel is now offering multiple PHP versions with EasyApache 4.
EasyApache 4 has multi PHP support with PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and PHP 7.1.
MongoDB PHP extension supports all the PHP versions and can be installed using pecl tool on the cPanel server.
pecl tool path is different for different PHP version Below we will see how to install mongoDB PHP extension on the server for different PHP versions
There are two extensions one is called mongo which supports from PHP 5.3 to PHP 5.6.
The other is called as mongodb which is supported by PHP 7.0 and PHP 7.1. Keep this in mind when installing the versions you want.
For PHP 5.5
/opt/cpanel/ea-php55/root/usr/bin/pecl install mongo
For PHP 5.6
/opt/cpanel/ea-php56/root/usr/bin/pecl install mongo
For PHP 7.0
/opt/cpanel/ea-php70/root/usr/bin/pecl install mongodb
For PHP 7.1
/opt/cpanel/ea-php71/root/usr/bin/pecl install mongodb