mac升级php版本,遇到libtiff.5.dylib不能载入的问题

PHP技术
756
0
0
2023-09-08

mac下今天升级php遇到一个问题,就是提示libtiff.5.dylib无法载入。

在mac下升级php版本还是很方便的

执行命令

brew update
brew upgrade php

就可以完成升级,升级完执行php -v,结果就直接报错了,如下:

leo@****-MacBook-Pro Temp % php -v

dyld[32539]: Library not loaded: /usr/local/opt/libtiff/lib/libtiff.5.dylib

  Referenced from: <680817AC-B5BC-3318-8304-56CC10242694> /usr/local/Cellar/gd/2.3.3_1/lib/libgd.3.dylib

  Reason: tried: '/usr/local/opt/libtiff/lib/libtiff.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/libtiff/lib/libtiff.5.dylib' (no such file), '/usr/local/opt/libtiff/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file, not in dyld cache), '/usr/local/Cellar/libtiff/4.5.1/lib/libtiff.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/libtiff/4.5.1/lib/libtiff.5.dylib' (no such file), '/usr/local/Cellar/libtiff/4.5.1/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file, not in dyld cache)

zsh: abort      php -v

首先看下这个目录/usr/local/opt/libtiff/lib/下的文件

leo@****-MacBook-Pro Temp % ll /usr/local/opt/libtiff/lib/
total 2432
-r--r--r--  1 leo  staff  517312  9  8 10:54 libtiff.6.dylib
-r--r--r--  1 leo  staff  674168  6 11 04:37 libtiff.a
lrwxr-xr-x  1 leo  staff      15  6 11 04:37 libtiff.dylib -> libtiff.6.dylib
-r--r--r--  1 leo  staff   36736  9  8 10:54 libtiffxx.6.dylib
-r--r--r--  1 leo  staff   10888  6 11 04:37 libtiffxx.a
lrwxr-xr-x  1 leo  staff      17  6 11 04:37 libtiffxx.dylib -> libtiffxx.6.dylib
drwxr-xr-x  3 leo  staff      96  9  8 10:54 pkgconfig

发现的确没有libtiff.5.dylib这个文件,而有libtiff.6.dylib这个文件,看到上面的错误信息:/usr/local/Cellar/gd/2.3.3_1/lib/libgd.3.dylib,貌似跟gd库有关,所以应该是gd库版本太低的原因导致的。

果断升级下gd库,问题就解决了,如下: