mac 运行 php 报 dyld: Library not loaded错误
执行php -v报如下错误
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib Referenced from: /usr/local/bin/php Reason: image not found [1] 89488 abort php -v
出现问题的原因应该是安装thrift以后icu4c升级导致的, 本地php7.1依赖icu4c库版本为63
ll /usr/local/Cellar/icu4c total 0 drwxr-xr-x 12 fww staff 384B 4 22 21:23 64.2
为了php正常运行需要回滚到63版本, thrift再说吧,以下为回滚过程
#切换目录 cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula #git查看提交版本 git log --follow icu4c.rb #回滚到63版本,没有看到63的提交记录,选择了最初的一个提交版本回滚 git checkout -b icu4c-63.1 xxxx(版本号) #brew重新安装icu4c brew reinstall ./icu4c.rb
验证结果
# php -v PHP 7.1.26 (cli) (built: Feb 26 2019 10:26:24) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans with Zend OPcache v7.1.26, Copyright (c) 1999-2018, by Zend Technologies
参考原文
https://blog.csdn.net/youshaoduo/article/details/89228454