MongodbPHP Extensions
This tutorial will show you how to install MongoDB extensions on Linux, Windows, MAC platforms.
Installing MongoDB PHP extensions on Linux on the terminal
You can install MongoDB's PHP extension driver by executing the following command in Linux
$ sudo pecl install MONGO
The PECL installation command using PHP must ensure that the network connection is available and rooted.
Installation Manuals
If you want to compile the extension driver through the source code. You have to manually compile the source package, so it's good that the latest bug fixes are included in the source package.
You can download the MongoDB PHP driver package on GitHub. Visit the GitHub website and search for "MONGO PHP Driver" (: https://github.com/mongodb/mongo-php-driver), download the source package, and then execute the following command:
$ tar zxvf mongodb-mongodb-php-driver-<commit_id>.tar.gz
$ CD mongodb-mongodb-php-driver-<commit_id>
$ phpize
$./configure
$ sudo make install
If your PHP is compiled yourself, the installation method is as follows (assuming it is compiled in the/usr/local/php directory):
$ tar zxvf mongodb-mongodb-php-driver-<commit_id>.tar.gz
$ CD mongodb-mongodb-php-driver-<commit_id>
$/usr/local/php/bin/phpize
$./configure--with-php-config=/usr/local/php/bin/php-config
$ sudo make install
After executing the above command, you need to modify the php.ini file, add the MONGO configuration in the php.ini file, and configure the following:
Extension=mongo.so
PHP MongoDB Extension Other extensions are similar