dyld:未加载库:/usr/local/lib/libpng.3.dylib使用php时

时间:2015-09-21 19:10:33

标签: php homebrew libpng

运行php时出现错误:

$ php -v
dyld: Library not loaded: /usr/local/lib/libpng.3.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Trace/BPT trap: 5

我读了这个dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib with anything php related,但我不确定PHP是否安装了brew作为此命令brew reinstall php55(或其他任何内容,如brew reinstall phpbrew reinstall php56)不起作用。

下一个答案建议对这个丢失的库进行符号化处理。 e.g。

$ locate libpng.3.dylib
/opt/X11/lib/libpng.3.dylib
/usr/local/php5/lib/libpng.3.dylib
$ ls -l /usr/local/php5/lib/libpng.3.dylib
lrwxrwxrwx  1 snowcrash  admin  18 15 Jan  2008 /usr/local/php5/lib/libpng.3.dylib -> libpng.3.0.0.dylib
$ ls -l /usr/local/php5/lib/libpng.3.0.0.dylib 
-rwxrwxrwx  1 snowcrash  admin  422632  4 May  2007 /usr/local/php5/lib/libpng.3.0.0.dylib
$ ln -s /usr/local/php5/lib/libpng.3.0.0.dylib  /usr/local/lib/libpng.3.dylib
$ php -v
dyld: Library not loaded: /usr/local/lib/libpng.3.dylib
Referenced from: /usr/local/bin/php
Reason: Incompatible library version: php requires version 20.0.0 or later, but libpng.3.dylib provides version 4.0.0
Trace/BPT trap: 5

但似乎版本太旧了,所以不知道该怎么做。我假设我需要以某种方式升级PHP或找到更新的libpng版本。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

我的解决方案是安装de libjpeg:

Get http://www.ijg.org/files/jpegsrc.v6b.tar.gz, and then: tar zxvf jpegsrc.v6b.tar.gz cd jpeg-6b cp /usr/share/libtool/config.sub . cp /usr/share/libtool/config.guess . ./configure --enable-shared --enable-static make sudo make install sudo ranlib /usr/local/lib/libjpeg.a