PHP MongoDB extension compilation and installation tutorial under cent OS

Source: Internet
Author: User
Tags php mongodb script php

The following content is reproduced from http://be-evil.org/post-284.html

Based on the lamp environment installed in yum in this blog, phpize is located at/usr/bin, PHP-config is located at/usr/bin, and PHP. INI is located at/etc/

Therefore, the following paths must be changed.

Server Environment cent OS 5.6 32-bit, PHP 5.2.17 compiling and installation, installation path/usr/local/PHP
 
First download the latest PHP MongoDB extension source code. The source code can be downloaded at http://pecl.php.net/package/#to
 
Wget http://pecl.php.net/get/mongo-1.2.0.tgz
 
Tar zxf http://pecl.php.net/get/mongo-1.2.0.tgz
 
CD mongo-1.2.0
 
After entering the folder, first run phpize to prepare the compiling extension environment. Here is the introduction of phpize.
 
/Usr/local/PHP/bin/phpize
 
The execution result is as follows:

After running, the./configure script is generated. At this time, we run the./configure script for configuration.
./Configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config
 
-- With-PHP-config indicates the path of the configuration script PHP-config.
 
The preceding command runs in a correctly configured environment and the result is as follows:

In this case, make is used to compile the extension.
 
Make & make install
 
The execution result of correct compilation is as follows (the last few lines of compilation output)

After editing, add a line to your php. ini file.
 
Extension = Mongo. So
The default php ini file is
/Usr/local/PHP/etc/PHP. ini
 
Restart your web server or PHP-FPM and print phpinfo. If you see the following content, congratulations! MongoDB extension has been installed successfully.

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.