Install the MongoDB driver in PHP and the phpmongodb driver.
Reference: http://docs.mongodb.org/ecosystem/drivers/php/
Method 1: Install with PECL
# Pecl install mongo
Enter "no" in the displayed dialog box"
After installation, the system prompts to write mongo. so to php. ini.
Method 2: Applicable only to users who cannot connect to the Internet
In fact, this method is the manual execution version of method 1.
: Http://pecl.php.net/package/mongo
[Root @ localhost] # tar-zxvf mongo-php-driver-1.5.8.tar.gz
[Root @ localhost] # mongo-php-driver-1.5.8 cd
Find your installed phpize (determined based on your installation directory)
[Root @ localhostmongo-php-driver-1.5.8] #/usr/local/php56/bin/phpize
Processing ing:
PHP ApiVersion: 20131106
Zend Module ApiNo: 20131226
Zend Extension ApiNo: 220131226
[Root @ localhost mongo-php-driver-1.5.8] #
./Configure -- enable-mongo = share -- with-php-config =/usr/local/php56/bin/php-config
[Root @ localhost mongo-php-driver-1.5.8] # make
Build complete.
Don't forget torun 'make test '.
[Root @ localhostmongo-php-driver-1.5.8] # make install
Installing extensions dextensions:/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/
The installation is successful. Next, configure php. ini.
Edit php. ini and add
Extension = mongo. so
Restart php-fpm
Pkill php-fpm
/Usr/local/php/sbin/php-fpm
Verification: php-m
Check whether mongo exists in the terminal output. If mongo exists, it indicates OK.
How to uninstall the driver?
# Pecl uninstall mongo
OK.