This gist took PHP - Manually Installing the MongoDB PHP Driver, as reference.
First locate your php-config file. To do so, you can trace it with locate php-config. It will be something like this:
It's the file that has all compiled php settings, and it will be used to tell config command, wich PHP should be compiled for.
git clone https://github.com/mongodb/mongo-php-driver.git
cd mongo-php-driver
git checkout v1.3 (or any other if you want to)
git submodule sync && git submodule update --init
phpize
./configure --with-php-config=Your-php-config
make
make install
Obs. At .configure line, Your-php-config should point to your php compiled directory, where should be a real php-config file. Like this example: /usr/php/7.0.9/exec/bin/php-config After that, just copy mongodb.so to php extensions path, and point it inside php.ini php extensions path, and php.ini location can be found using phpinfo function, or php -i on cli.
If there is any problem related to OpenSSL location, at .configure run time, just try to link it, like this:
cd /usr/local/include $ ln -s ../opt/openssl/include/openssl