设为首页 加入收藏

TOP

PHP安装MongoDB驱动
2015-07-24 11:58:26 来源: 作者: 【 】 浏览:7
Tags:PHP 安装 MongoDB 驱动

方法1:使用PECL安装

#pecl install mongo

在出现的对话框中输入“no”

\

安装完后,提示将mongo.so写入php.ini

\

方法2:仅适用于无法连接外网用户使用

其实这个方法就是方法1的手动执行版

下载地址:http://pecl.php.net/package/mongo

?

[root@localhost ]#tar -zxvf mongo-php-driver-1.5.8.tar.gz

[root@localhost]# cd mongo-php-driver-1.5.8

找到自己安装的phpize(根据自己安装目录确定)

[root@ localhostmongo-php-driver-1.5.8]# /usr/local/php56/bin/phpize

Configuring for:

PHP ApiVersion: 20131106

Zend Module ApiNo: 20131226

Zend Extension ApiNo: 220131226

[root@localhost mongo-php-driver-1.5.8]#

./configure --enable-mongo=share--with-php-config=/usr/local/php56/bin/php-config

[root@localhost mongo-php-driver-1.5.8]#make

Build complete.

Don't forget torun 'make test'.

[root@ localhostmongo-php-driver-1.5.8]# make install

Installing sharedextensions: /usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/

说明安装成功 接下来配置php.ini

编辑php.ini 加入

extension=mongo.so

重启php-fpm

pkill php-fpm

/usr/local/php/sbin/php-fpm

验证:php –m

查看终端输出是否有mongo,有的话,证明OK

如何卸载这个驱动呢?

#pecl uninstall mongo

就ok了

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇sys_refcursor的用法实例 下一篇ADO.NET之5-使用Command对象删除..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Sphinx : 高性能SQL (2025-12-24 10:18:11)
·Pandas 性能优化 - (2025-12-24 10:18:08)
·MySQL 索引 - 菜鸟教 (2025-12-24 10:18:06)
·Shell 基本运算符 - (2025-12-24 09:52:56)
·Shell 函数 | 菜鸟教 (2025-12-24 09:52:54)