brew update灾难来了!

我以前用brew 安装了多个php的版本,早上执行了brew update后php就用不了了

# openssl版本不对了
➔ /usr/local/opt/php@5.6/bin/php -v
dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /usr/local/opt/php@5.6/bin/php
  Reason: image not found
[1]    16051 abort      /usr/local/opt/php@5.6/bin/php -v
# 把我的xdebug.so删掉了
➔ /usr/local/opt/php@7.2/bin/php -v
Failed loading /usr/local/opt/php@7.2/lib/php/20170718/xdebug.so:  dlopen(/usr/local/opt/php@7.2/lib/php/20170718/xdebug.so, 9): image not found
PHP 7.2.32 (cli) (built: Jul 10 2020 00:06:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.32, Copyright (c) 1999-2018, by Zend Technologies
# 又不知道缺了啥
➔ /usr/local/opt/php@7.4/bin/php -v
dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib
  Referenced from: /usr/local/opt/php@7.4/bin/php
  Reason: image not found
[1]    16126 abort      /usr/local/opt/php@7.4/bin/php -v

我真的是太难了!!!

php5.6解决办法

其实可能我的电脑里已经有openssl@1.0,只是软链接指向变了,你也可以先直接修改软链接试试。

# 安装openssl@1.0
brew install rbenv/tap/openssl@1.0

# 修改symlink
ln -sf /usr/local/opt/openssl@1.0 /usr/local/opt/openssl

继续尝试:

➔ /usr/local/opt/php@5.6/bin/php -v
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/php@5.6/bin/php
  Reason: image not found
[1]    52151 abort      /usr/local/opt/php@5.6/bin/php -v

看看是否icu4c的老版本在不在吧:

➔ ll /usr/local/opt/icu4c
lrwxr-xr-x  1 jake  admin    20B Jul 22 11:36 /usr/local/opt/icu4c -> ../Cellar/icu4c/67.1

ll /usr/local/Cellar/icu4c/
total 0
drwxr-xr-x  12 jake  staff   384B Jun 28  2019 64.2
drwxr-xr-x  12 jake  staff   384B Jul 22 11:36 67.1

可能是64.2,试试:

ln -sf /usr/local/Cellar/icu4c/64.2 /usr/local/opt/icu4c

这一次php5.6就复活了!

➔ /usr/local/opt/php@5.6/bin/php -v                                                     
PHP 5.6.40 (cli) (built: Apr 23 2019 11:14:34) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

php7.2那还能怎么办,选择原谅她啦

去这里:https://xdebug.org/wizard 把phpinfo的信息粘进去,重新build一个吧。

但是其实更严重的问题来了,php7.2依赖/usr/local/Cellar/icu4c/67.1,而php5.6依赖/usr/local/Cellar/icu4c/64.2,(php7.4却可以正常,神奇!)那只好把/usr/local/Cellar/icu4c/67.1的内容复制到/usr/local/Cellar/icu4c/64.2去吧:

# 复制以下两种文件似乎就可以了
➔ cp /usr/local/Cellar/icu4c/67.1/lib/*.67.1.dylib /usr/local/Cellar/icu4c/64.2/lib/
➔ cp /usr/local/Cellar/icu4c/67.1/lib/*.67.dylib /usr/local/Cellar/icu4c/64.2/lib/

➔ /usr/local/opt/php@7.2/bin/php -v
Failed loading /usr/local/opt/php@7.2/lib/php/20170718/xdebug.so:  dlopen(/usr/local/opt/php@7.2/lib/php/20170718/xdebug.so, 9): image not found
PHP 7.2.32 (cli) (built: Jul 10 2020 00:06:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.32, Copyright (c) 1999-2018, by Zend Technologies

可以了,稍后去把xdebug.so build出来。

php7.4如法炮制

➔ rm /usr/local/opt/libffi
➔ ln -s /usr/local/Cellar/libffi/3.2.1 /usr/local/opt/libffi

➔ /usr/local/opt/php@7.4/bin/php -v
PHP 7.4.4 (cli) (built: Mar 19 2020 20:12:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.4, Copyright (c), by Zend Technologies
    with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans

发表评论

电子邮件地址不会被公开。 必填项已用*标注