1
votes

I am getting an error when running 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

I read this dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib with anything php related but I'm not sure if PHP was installed with brew as this command brew reinstall php55 (or anything else like brew reinstall php, brew reinstall php56) does not work.

The next answer suggests symlinking this missing library. 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

but it seems the version is too old so not sure what to do. I assume I need to upgrade PHP somehow or find a more up to date version of libpng.

Any suggestions?

1
The workarounds for libjpeg applies here too.sepehr

1 Answers

0
votes

the solution for me, was install 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