【问题标题】:Mongo DB PHP Driver Installation Fails on OS X Sierra在 OS X Sierra 上安装 Mongo DB PHP 驱动程序失败
【发布时间】:2017-04-18 05:37:23
【问题描述】:

我刚刚更新到 Mac OS Sierra 版本 10.12.1 并执行了

sudo pecl install mongodb

安装失败并显示此消息

Configure: error: Cannot find OpenSSL's <evp.h>
ERROR: `/private/tmp/pear/temp/mongodb/configure' failed

也尝试使用 Homebrew 安装

brew install php56-mongo

但仍未安装 mongo db php 驱动程序 phpinfo() 不显示 mongo 扩展。

也尝试了这里提供的解决方案Using pecl to install the Mongodb driver on OS X El Capitan (v10.11.1)

当我尝试执行时

brew install openssl 

Warning: openssl-1.0.2j already installed

当我执行时 brew link openssl --force 上面写着

Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

知道如何让它工作吗?

【问题讨论】:

标签: php mongodb macos homebrew


【解决方案1】:

你必须先从终端点击 PHP 公式库,像这样

brew tap homebrew/php

为了通过 Homebrew 安装 MongoDB 等 PHP 扩展。 点击公式存储库后,安装 MongoDB 扩展

brew install php56-mongo

就我而言,我安装了 php56-mongo 驱动程序

安装后检查mongo.so在文件中的位置

/usr/local/etc/php/5.6/conf.d/ext-mongo.ini

只需复制mongo.so路径的位置

extension="/usr/local/opt/php56-mongo/mongo.so"

添加php.ini并重启apache

sudo apachectl restart

现在最后检查 phpinfo(),它应该会显示已安装的 mongo 驱动程序

【讨论】:

    【解决方案2】:

    我认为您也应该安装“pkg-config”软件包。 MongoDB 的 PHP 驱动程序使用它来了解 OpenSSL。

    【讨论】:

    • 我已经安装了 pkg-config,pkg-config --version 给出 0.29.1
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-23
    • 2018-09-28
    • 1970-01-01
    • 2016-01-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多