Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用pecl在OS X El Capitan(v10.11.1)上安装Mongodb驱动程序_Php_Xcode_Macos_Mongodb_Osx Elcapitan - Fatal编程技术网

Php 使用pecl在OS X El Capitan(v10.11.1)上安装Mongodb驱动程序

Php 使用pecl在OS X El Capitan(v10.11.1)上安装Mongodb驱动程序,php,xcode,macos,mongodb,osx-elcapitan,Php,Xcode,Macos,Mongodb,Osx Elcapitan,我正在尝试为OSX安装php mongo驱动程序。我尝试了以下操作,但没有成功 $which pecl->/usr/local/ceral/php56/5.6.13_2/bin/pecl $sudo pecl install mongo->完整构建结果,但问题是错误: In file included from /private/tmp/pear/install/mongo/io_stream.c:34: /private/tmp/pear/install/mongo/contrib/php-s

我正在尝试为OSX安装php mongo驱动程序。我尝试了以下操作,但没有成功

$which pecl->/usr/local/ceral/php56/5.6.13_2/bin/pecl

$sudo pecl install mongo->完整构建结果,但问题是错误:

In file included from /private/tmp/pear/install/mongo/io_stream.c:34:
/private/tmp/pear/install/mongo/contrib/php-ssl.h:33:10: fatal error: 'openssl/evp.h' file not found
#include <openssl/evp.h>
我的Xcode命令行工具是最新的,我使用$Xcode select-install来确保

我确定如何解决这个问题。

我建议使用这种类型的东西。它让您可以轻松地将任何扩展安装到所需的任何php版本


在安装新版本的php时,我通常会在编译时关注日志。可能存在需要首先安装的依赖项。另外,请确保您安装了最新版本的homebrew。

我通过使用homebrew安装OpenSSL解决了这一问题:

然后


您需要禁用Mac OSX El Captián无根机制:

用Cmd-R引导 开放式终端 csrutil型禁用 重新启动 在Mac上,您需要安装Xcode,并为Xcode附带的openssl构建符号链接,即

cd /usr/include;
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/openssl
这样做

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

为什么要否决我的问题?我已经研究过这个问题,但找不到El Capitan的解决方案;人们应该使用mongodb。强制brew链接也适用于较新的软件包mongodb。谢谢@以西结王救了我的命!当然可以我现在提交了一份编辑来更新他的答案。可能一开始就应该这样做。这不会再起作用了,应该是不安全的。警告:拒绝链接:openssl链接keg only openssl意味着您在使用自制openssl的头文件时,可能会链接到不安全、不推荐使用的系统openssl。相反,将完整的include/library路径传递给编译器,例如:-I/usr/local/opt/openssl/include-L/usr/local/opt/openssl/lib@EzekielVictor我更新到mac os Sierra,当我尝试执行brew安装open ssl时,它会显示警告:openssl-1.0.2j已安装,当我再次执行brew link openssl-force时,它会显示警告:拒绝链接:openssl链接keg only openssl意味着您可能会在使用Homebrew openssl的头文件时链接到不安全、不推荐的系统openssl。相反,将完整的include/library路径传递给编译器,例如:-I/usr/local/opt/openssl/include-L/usr/local/opt/openssl/lib知道如何使其工作吗?我已经有了openssl和pkg配置,但仍然得到了错误。这个解决方案对我很有效。在用尽了所有其他在线可用的解决方案之后,这个方案对我也很有效。
cd /usr/include;
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/openssl
$ cd /usr/local/include 
$ ln -s ../opt/openssl/include/openssl