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