PHP Assembly MONGO Extensions

Source: Internet
Author: User
Tags php mongodb script php zts
PHP Installation MONGO Extensions
PHP MONGO Extension Installation:



Server environment cent OS 5.6 64 bit, PHP version 5.2.17 compiled installation, installation path/usr/local/php



First download the latest PHP mongodb extension source code, the source code can be downloaded to the Http://pecl.php.net/package/mongo

wget http://pecl.php.net/get/mongo-1.2.2.tgz

Tar zxf mongo-1.2.2.tgz

CD mongo-1.2.2

After entering the folder, first run phpize to prepare the environment for compiling the extension, phpize the introduction of this program here



/usr/local/php/bin/phpize






----------------------------------------------
The following is the resolved version when an exception is installed



Based on this blog Yum installed lamp environment, Phpize is located in/usr/bin,php-config located in/usr/bin,php.ini located in/etc/

1. First select the appropriate version of MongoDB expansion pack download from Http://pecl.php.net/package/mongo.

2. Unzip the expansion pack and go to the unzip directory

TAR-ZXF mongo-1.4.1.tgz

CD mongo-1.4.1

3. Execute phpize in the mongo-1.3.2 directory with the following command: (Note: This tool is a tool for adding extensions to PHP, my phpize location is/www/php/bin/phpize)

/usr/local/php/bin/phpize

Note: Sometimes there is a hemorrhagic error:

Configuring for:

PHP Api version:20041225

Zend Module Api no:20060613

Zend Extension Api no:220060519

Cannot find autoconf. Please check your autoconf installation and the

$PHP _autoconf environment variable. Then, the rerun this script

The problem is that M4 and autoconf are not installed

Can download http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz installation package Installation

or yum-y install M4 autoconf

The Configure file is then generated

4. Execute the following command:

./configure--with-php-config=/usr/local/php/bin/php-config

Note: The –with-php-config parameter needs to specify the location of the Php-config file, not the location of the php.ini file

Creating Libtool

Appending configuration Tag "CXX" to Libtool

Configure:creating./config.status

Config.status:creating config.h

5. Review the configuration information if it is correct, compile and install:

Make&&make Install

The correct compilation execution results are as follows:

Build complete.

Don ' t forget to run ' make test '.

Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20130712/

6. After compiling the installation, add a sentence in php.ini:

Extension=mongo.so

7. Restart PHP-FPM or Web service, view phpinfo, if there is MongoDB, congratulations, the installation was successful



The following results are performed after the run:

Configuring for:

PHP Api version:20041225

Zend Module Api no:20060613

Zend Extension Api no:220060519



After running, the./configure script is generated, and this time we run the./configure script to configure

./configure--with-php-config=/usr/local/php/bin/php-config

--with-php-config This parameter is to tell the configuration script php-config the path of this program, Php-config's introduction here



The above command runs in a properly configured environment with the following results



Creating Libtool

Appending configuration Tag "CXX" to Libtool

Configure:creating./config.status

Config.status:creating config.h



Then compile the extension with make.
Make && make install

The correct compilation execution results are as follows:



Build complete.

Don ' t forget to run ' make test '.




Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/



When you're done, edit your php.ini file to add a line
Extension=mongo.so
The general default of compiling PHP INI file in
/usr/local/php/etc/php.ini
Restart your Web server or PHP-FPM, print phpinfo, if you see the MONGO table, then the MongoDB extension installation succeeded
  • 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.