Home > php教程 > php手册 > body text

php安装mongo扩展教程

WBOY
Release: 2016-06-06 20:14:04
Original
1033 people have browsed it

mongo db是个好东西,越来越多的项目中有使用到。 下面介绍如何安装mongo扩展 环境 nginx/1.4.4PHP 5.4.22MongoDB 2.4.10 下载扩展安装包 wget http://pecl.php.net/get/mongo-1.4.5.tgz 编译安装 tar xvf mongo-1.4.5.tgz -C /usr/srccd /usr/src/mongo-1.4

mongo db是个好东西,越来越多的项目中有使用到。
下面介绍如何安装mongo扩展

环境

nginx/1.4.4
PHP 5.4.22
MongoDB 2.4.10
Copy after login

下载扩展安装包

wget http://pecl.php.net/get/mongo-1.4.5.tgz
Copy after login

编译安装

tar xvf mongo-1.4.5.tgz -C /usr/src
cd /usr/src/mongo-1.4.5/
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
Copy after login

配置php.ini,增加下面两行

[mongo]
extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/mongo.so
Copy after login

重新加载php-fpm, nginx

pkill php-fpm
/usr/local/php/sbin/php-fpm
/usr/local/nginx/sbin/nginx -s reload
Copy after login

验证是否安装成功

php -m | grep mongo
# 或者查看phpinfo页面
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template