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.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。