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/
1. First, download the corresponding mongodbextended package from http://pecl.php.net/package.
2. decompress the extension package and enter the decompressed directory.
Tar-zxf mongo-1.4.1.tgzcd mongo-1.4.1
3. Execute phpize in the mongo-1.3.2 directory, the command is as follows :( note: this tool is Php add extension tool, my phpize location is/www/PHP/bin/phpize)
/Usr/local/PHP/bin/phpize Note: Sometimes the following error occurs:
- Processing ing:
- Php api version: 20041225
- Zend module api no: 20060613
- Zend extension api no: 220060519
- Cannot find Autoconf. Please check your Autoconf installation and
- $ Php_autoconf environment variable. Then, rerun this script
Problem: M4 and Autoconf can be downloaded without installing 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 or yum-y install M4 Autoconf
Generate the configure file
4. Execute the following command:
./Configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config
Note: The-with-PHP-config parameter must specify the location of the PHP-config file, rather than 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. Check the configuration information and compile and install the configuration correctly:
Make & make install
The correct compilation and 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 compilation and installation are complete, add the following sentence to PhP. ini:
Extension = Mongo. So
7. Restart PHP-FPM or web service and check phpinfo. If you have MongoDB, congratulations, the installation is successful.