'openssl/evp.h' 找不到文件 OS x Mongodb

'openssl/evp.h' file not found OS x Mongodb

有一个母马与此。我正在尝试安装最新的 PHP mongo 数据库驱动程序。我到处都看过并尝试了所有建议但它不会通过此错误:


In file included from /private/tmp/pear/install/mongodb/src/contrib/php-ssl.c:31:
/private/tmp/pear/install/mongodb/src/contrib/php-ssl.h:33:10: fatal error: 'openssl/evp.h' file not found
include <openssl/evp.h>
         ^
1 error generated.
make: *** [src/contrib/php-ssl.lo] Error 1
ERROR: `make' failed

我的系统/设置:

OS X El Capitain v 10.11.6
PHP7.1.0
阿帕奇

我正在使用此命令安装它:sudo pecl install mongodb

我试过:

$ brew install openssl
$ brew link openssl --force

但这不再有效......并且任何最新的解决方法都不起作用

我什至尝试过 "rootless" 但无济于事。

This solution 对我有用。如果您还没有 openssl,那么首先 运行 brew install openssl。 然后 运行:

$ cd /usr/local/include 
$ ln -s ../opt/openssl/include/openssl .

需要两件事。 @ierdna 建议的那个是我工作所需要的,但只有在我执行以下操作之后

~$ brew install openssl
~$ brew info openssl

按照 brew 的指示进行导出

~$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
~$ export CPPFLAGS="-I/usr/local/opt/openssl/include"

然后按照 ierdna 告诉你的去做..

~$ cd /usr/local/include
~$ ln -s ../opt/openssl/include/openssl .

它立即对我有用