How to install on macOS Mojave
Start with:
sudo pecl install mongodb
To check if mongodb package is installed, look for "mongodb" when you run:
pecl list
To get your installed mongodb.so path, run:
pecl list-files mongodb | grep mongodb.so
then remove (or comment out) on your php.ini file:
extension="mongodb.so"
(I could not found a line with extension="php_mongodb.so")
now insert a line with:
extension="{{the path to your installed mongodb.so}}"
Run this command to get your ext-*.ini directory path:
php -i | grep Scan
Create your ext-mongodb.ini with:
touch {{your conf.d path}}/ext-mongodb.ini
like:
touch /usr/local/etc/php/7.1/conf.d/ext-mongodb.ini
Restart your apache to read the new configuration
Sanity check with:
php -i | grep mongodb
Your're ready to go.