Installation Environment: Centos 6.5
PHP 5.3.27
Here PHP is installed, the installation path is:
/usr/local/php/
To download the installation file:
Http://pan.baidu.com/s/1sjjTmbz
Get file: mongo-php-driver.tar.gz
Unpack the files and go to the installation folder:
tar -zxf mongo-php-driver. Tar . Gzcd. /mongo-php-driver
Compile and install the extension:
/usr/local/php/bin/phpize. /configure--with-php-config=/usr/local/php/bin/php-configmakeinstall
To modify the PHP configuration file php.ini, add the extension settings:
Extension=mongo.so
Note: you need to indicate the path to the Extension_dir configuration item.
Verify that you have successfully installed the MONGO extension:
grep MONGO
If you see the following:
Mongo
Indicates that the installation is successful.
PHP Create connection:
$mongoCon = new Array (' connect ' = =true, ' persist ' =true));
The MongoDB database can be manipulated with $mongoCon .