美文网首页
php mongodb 扩展安装

php mongodb 扩展安装

作者: php_number_one | 来源:发表于2018-08-30 16:35 被阅读0次

去下载 https://pecl.php.net/package/mongodb  需要对应的版本

解压 mongodb 下载包,进入到文件目录中

你php安装路径中到 phpize 用于安装php扩展使用
/usr/local/Cellar/php/7.2.9_2/bin/phpize

编译前配置文件检测准备工作 执行下面命令

./configure --with-php-config=/usr/local/Cellar/php/7.2.9_2/bin/php-config

注意 ==》/usr/local/Cellar/php/7.2.9_2/bin/php-config (是你自己的php 目录下面bin/php-config)

./configure --with-php-config=/usr/local/Cellar/php/7.2.9_2/bin/php-config --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2p

// --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2p ==》 需要依赖openssl 这个版本需要大于1.0的所以你本机如果openssl 版本低则自己更新或者重新安装openssl

mac 机器 brew openssl 命令  

接下来开始编译 安装了

sudo make 

sudo make install

到这基本就安装成功了mongodb扩展mongodb.so 文件了 ,在目录 /usr/local/Cellar/php7.2.9_2/pel/20170718/目录中

最后配置你到php.ini  添加下面一行代码

extension=mongodb.so

php -m  命令 查看是否有成功有mongodb 扩展

安装成功了 有mongodb模块。 你也可以通过 phpinfo() 方法查看。

相关文章

网友评论

      本文标题:php mongodb 扩展安装

      本文链接:https://www.haomeiwen.com/subject/coqdwftx.html