Install the MongoDB driver in PHP and the phpmongodb driver.

Source: Internet
Author: User
Tags mongodb driver

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.