& # 39; openssl / evp.h& # 39;文件未找到OS x Mongodb


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

有一匹马。我试图安装最新的PHP mongo DB驱动程序。我已经找遍了所有地方并尝试了所有建议,但它不会通过这个错误:


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

My system/setup:

OS X El capitainv 10.11.6
PHP 7.1.0
Apache

我使用这个命令来安装它:sudo pecl install mongodb

我试过了:

$ brew install openssl
$ brew link openssl --force

,但不再工作…任何最新的解决方法都不起作用

我甚至尝试过"无根",但都无济于事。

这个解决方案对我很有效。如果您还没有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"

那就照erdna说的去做。

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

马上就见效了