1. First download the PHP mongodb extension
Download the MongoDB extension source package from the Http://pecl.php.net/package/mongo URL
1
wget http://pecl.php.net/get/mongo-1.4.5.tgz
2. Unzip the installation package
1
Tar zxf mongo-1.4.5.tgz
3. Go to unzip directory and run Phpize to prepare for installation
1
2
CD mongo-1.4.5
/usr/local/php/bin/phpize
4. Install and compile
When the above command finishes running, the Configure file is generated in the directory
Use the./configure command to install the configuration, and then compile the installation using make && makes install, with the following command:
1
2
./configure--with-php-config=/usr/local/php/bin/php-config
Make && make install
5. Edit PHP.ini Add the MongoDB extension by adding the following line
1
Extension=mongo.so
Restart the Web container, and then look at the phpinfo and see the contents of MongoDB to indicate that the installation was successful.
The MongoDB extension of PHP