前因:
公司使用的phalcon3 只能支持到php7.2。之前一直都是在远端开发,今天想在本地装一下php7.2。安装没问题,使用php -m验证时却出现了下面的错误
dyld: Library not loaded: /usr/local/opt/tidy-html5/lib/libtidy.5.dylib
Referenced from: /usr/local/Cellar/php@7.2/7.2.34_4/bin/php
Reason: image not found
zsh: abort /usr/local/Cellar/php@7.2/7.2.34_4/bin/php -m
问题排查:
提示我找不到 /usr/local/opt/tidy-html5/lib/libtidy.5.dylib,进入 /usr/local/opt/tidy-html5/lib/ 看了一下,发现果然没有
xuzhen@xuzhendeMBP lib % pwd
/usr/local/opt/tidy-html5/lib
xuzhen@xuzhendeMBP lib % ll
total 5440
-rw-r--r-- 1 xuzhen staff 864944 Jul 13 17:32 libtidy.5.8.0.dylib
lrwxr-xr-x 1 xuzhen staff 19 Jul 11 04:53 libtidy.58.dylib -> libtidy.5.8.0.dylib
-r--r--r-- 1 xuzhen staff 1047144 Jul 11 04:53 libtidy.a
lrwxr-xr-x 1 xuzhen staff 16 Jul 11 04:53 libtidy.dylib -> libtidy.58.dylib
drwxr-xr-x 3 xuzhen staff 96 Jul 13 17:32 pkgconfig
问题处理:
有 libtidy.5.8.0.dylib,又软连出了一个 libtidy.58.dylib。那是不是再软连出一个 libtidy.5.dylib 问题就解决了?试一下
cp libtidy.58.dylib libtidy.58.dylib_bak && ln -s libtidy.58.dylib libtidy.5.dylib
然后执行php -m
xuzhen@xuzhendeMBP lib % /usr/local/Cellar/php@7.2/7.2.34_4/bin/php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_dblib
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
phpdbg_webhelper
posix
pspell
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
[Zend Modules]
问题解决!!!