https://github.com/mongodb/mongo-php-library
$ pecl install mongodb
$ echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
执行完第一行命令就完成安装了
Build process completed successfully
Installing '/usr/local/Cellar/php@7.1/7.1.23/pecl/20160303/mongodb.so'
install ok: channel://pecl.php.net/mongodb-1.5.5
Extension mongodb enabled in php.ini
重启php-fpm, 访问phpinfo();已经可以看到mongodb扩展已存在了。