PHP Add MongoDB Extended Instance Tutorial

Source: Internet
Author: User
Tags install php ini mongodb

The compilation of PHP MONGO module

To download the current stable stable version from Http://, the latest stable release is 1.5.2 and the installation steps are as follows:

The code is as follows Copy Code
# wget Http://
# tar ZXVF mongo-1.5.2.tgz
# CD mongo-1.5.2
# Make && make install

Note: When there is no phpize tool, the tool can be installed through yum-y install Php-devel.

Second, the expansion of PHP configuration

When you are done, add the following in/etc/php.ini:

The code is as follows Copy Code

When you are done, use the php-m view to find the error:

The code is as follows Copy Code
# Php-m|grep MONGO
/usr/lib64/php/modules/ Symbol:php_json_encode in Unknown on line 1

The online query found that it is necessary to rely on the module, after viewing the/usr/lib64/php/modules/directory already exists module. The reason for the error is that the is loaded after The configuration of the following JSON was found in the/etc/php.ini, and the discovery did not exist. A Json.ini file was found in the/ETC/PHP.D directory.

The code is as follows Copy Code
# Cat/etc/php.d/json.ini
; Enable JSON Extension Module

Know the reason, also according to gourd painting scoop, will just in/etc/php.ini MONGO configuration Delete, in the/etc/php.d/directory add Mongo.ini, content for, configuration completed after use Php-m|grep MONGO detection was found to be normal.

Note: There are some ways to do this online by deleting the/etc/php.d/json.ini file and adding the JSON module's configuration to the MONGO module configuration in the/etc/php.ini file. Although this method can be, it is not recommended, because the above method will automatically look at the dependencies between the modules, and then decide the order of loading. The same can be resolved automatically if the situation is encountered by other modules.

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: 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.