Home  >  Article  >  Backend Development  >  Ubuntu下为Xampp中的PHP安装MongoDB驱动

Ubuntu下为Xampp中的PHP安装MongoDB驱动

WBOY
WBOYOriginal
2016-06-23 13:37:321028browse

此处所指的Xampp为: XAMPP

具体的配置环境:

KUbuntu 14.04LTS 64bit Lampp 1.8.3-4

首先,从GitHub获取MongoDB PHP驱动的最新源码: https://github.com/mongodb/mongo-php-driver

在按提示操作前,安装以下依赖:

sudo apt-get install install m4

sudo apt-get install autoconf

sudo apt-get install libssl-dev

然后,再按照项目文档进行操作:

phpize

./configure

make

sudo make install

注意,如果提示找不到 phpize, 则需要将XMAPP中相关执行文件添加到环境变量中。又或者直接指定,如果Xampp是安装在/opt目录下,则phpize所在目录为 /opt/lampp/bin/phpize。

随后,则php.ini中添加相应配置即可:
extension=mongo.so

可以用下列命令查询php.ini的所在位置:
php -i | grep php.ini

Statement:
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