安装php扩展时io_stream.lo错误1

安装php扩展时io_stream.lo错误1,php,mongodb,osx-elcapitan,Php,Mongodb,Osx Elcapitan,我试图在OSX 10.11上安装mongo php扩展,但命令: sudopecl安装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 <opens

我试图在OSX 10.11上安装mongo php扩展,但命令:

sudopecl安装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>
         ^
1 error generated.
make: *** [io_stream.lo] Error 1
ERROR: `make' failed
。。。
在/private/tmp/pear/install/mongo/io_stream.c:34中包含的文件中:
/private/tmp/pear/install/mongo/contrib/php ssl.h:33:10:致命错误:“未找到openssl/evp.h”文件
#包括
^
生成1个错误。
make:**[io_stream.lo]错误1
错误:`make'失败
evp是高级加密函数

尝试安装开发库:

Ubuntu:sudo-apt-get-install-libssl-dev

CentOS:yum安装openssl-devel


来源:

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

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

    i、 e.
    /usr/include/openssl
    指向Xcode库

    构建mongo php库

    完成后,您应该启用无根安全保护:

  • 用Cmd-R引导
  • 开放式终端
  • 键入
    csrutil启用
  • 重新启动
  • brew安装openssl
  • ln-s/usr/local/ceral/openssl/1.0.2d\u 1/include/openssl/usr/local/include/openssl

  • 我使用的是OSX,在/usr/local/openssl中有一个自定义的openssl构建

    因此:


    斯科特·维尔斯多夫的解决方案似乎对我有效

    通过brew安装opnessl

    brew install openssl
    
    链接openssl

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

    您也考虑过安装openssl吗?这里应该提到两件事。。。1) 我在mac电脑上,不是ubuntu或centos,openssl已经安装并启用了……听起来像是一个与否非常相似的问题?这并不能回答这个问题。若要评论或要求作者澄清,请在其帖子下方留下评论-您可以随时在自己的帖子上发表评论,一旦您有足够的评论,您就可以发表评论。@200好的,让我澄清一下:如果您已经安装了自制软件,您就不必再与csrutil发生冲突。因为它允许修改/usr/local。我认为这很常见,因为我们大多数人都使用自制或macports等。这个答案是正确的,没有重新启动或运行csrutil。(我已经用El capitan 10.11.2、homebrew 0.9.5对PHP7对mongodb进行了测试,驱动程序1.2对PHP7分支进行了测试,当然成功了)您的系统上可能安装了不同版本的openssl,因此您需要在第二个命令上更改路径。这无疑帮助我在最新的OSX上完成了
    sudo pecl install mongo
    (我已经禁用了无根)+1.
    brew install openssl
    
    $ cd /usr/local/include
    $ ln -s ../opt/openssl/include/openssl