douyuefei3546 2015-12-31 06:22
浏览 201

libphp7.so需要12.0.0或更高版本

I have a fresh installation of OSX el capitan 10.11.2 and installed php7 using homebrew.Now getting following error

command

sudo apachectl -e info -k restart

error

httpd: Syntax error on line 171 of /private/etc/apache2/httpd.conf:
 Cannot load /usr/local/opt/php70/libexec/apache2/libphp7.so into server: dlopen(/usr/local/opt/php70/libexec/apache2/libphp7.so, 10):
 Library not loaded: /usr/local/opt/libxml2/lib/libxml2.2.dylib
  Referenced from: /usr/local/opt/php70/libexec/apache2/libphp7.so
  Reason: Incompatible library version: libphp7.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0

I have searched on google but didn't get any specific solution.

  • 写回答

2条回答 默认 最新

  • dongzhong5573 2016-06-06 05:51
    关注

    PLEASE DO NOT DO THIS!!! YOUR BEST BET IS TO REINSTALL MAC OS X

    Alright, I just found a way. It is kinda hacky, but it works.

    When trying to run PHP 7, apache checks for libxml2.2.dylib under /usr/lib. To check what version it is currently at, you can run otool -L /usr/lib/libxml2.2.dylib.

    That will probably output something like this:

    /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
    

    But Apache and PHP want version 12.0.0, so let's install it through homebrew.

    brew install libxml2 libxslt libiconv
    

    This will install libxml to something like /usr/local/Cellar/libxml2/2.9.4/lib. This directory will contain a file called libxml2.2.dylib.

    If you run otool -L /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib, it will output:

    /usr/local/opt/libxml2/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.4.0)
    

    So THIS is the version PHP and Apache are looking for. We are going to want to move this file to /usr/lib. But not so fast, we already have a file named libxml2.2.dylib in that folder so lets just add the .bak extension just in case we need it again.

    sudo mv /usr/lib/libxml2.2.dylib /usr/lib/libxml2.2.dylib.bak
    

    Now we can move the file that homebrew installed to this directory.

    sudo cp /usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib /usr/lib
    

    That's it! Now you should be able to run sudo apachectl -e info -k restart with no errors and PHP 7 should work correctly.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向