解决brew安装的PHP报错Unable to initialize module

  • 解决brew安装的PHP报错

    1
    2
    3
    4
    5
    6
    Cannot load Zend OPcache - it was built with configuration API220131226,NTS, whereas running engine is API220131226,NTS,debug
    PHP Warning: PHP Startup: igbinary: Unable to initialize module
    Module compiled with build ID=API20131226,NTS
    PHP compiled with build ID=API20131226,NTS,debug
    These options need to match
    in Unknown on line 0
  • 解决办法
    原因是因为编译的方式不同,导致不一致,所以导致不能加载,这里提醒,一般情况下使用brew直接安装上扩展,这样就不会报错了

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # 来源github brew issue
    I loaded up a fresh copy of OS X 10.10 and do not have this problem. If you have a non-bottled version of PHP, then you may be seeing the clash with the bottled version of php56-opcache. I think one of the following options will work:

    Skip the bottle for php56-opcache (I don't recommend this long-term, see below):

    brew install --build-from-source php56-opcache
    It would be preferable to use the bottled version of PHP 5.6 so you can use bottles from future formulas and save compile time. Here's how you can transition:
    (export ALLPHP56=$(brew list | grep -E '^php56') ; brew uninstall --force $ALLPHP56 ; brew insta
    //或者直接也是可以的
    brew reinstall --build-from-source php56-opcache
感谢老板!