Using any php application results in:
dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
Just in case someone else runs into this problem I solved it by the following
brew update && brew upgrade # installs libpng 1.6
This caused an error with other packages requiring 1.5 which they were built with, so I linked it:
cd /usr/local/lib/
ln -s ../Cellar/libpng/1.5.18/lib/libpng15.15.dylib
Now they are both living in harmony and side by side for the different packages. It would be better to rebuild the packages that depend on 1.5, but this works as a quick bandage fix.
I had very hard time with this error :
Reason: Incompatible library version: php requires version 44.0.0 or later, but libpng16.16.dylib provides version 42.0.0 Trace/BPT trap: 6
I did all the above things with brew and much more ... but it wasn't this !
Check where your library is :
sudo find / -name libpng16.16.dylib
In my case here was the relevant result :
So as I'm a MAMP user it turn out that the error appeared while I was trying to update from PHP 7.1.0 to 7.1.8 (last MAMP php available) as Symfony4 require at least 7.1.3
At the end I instaled the new version of MAMP and it worked (4.1 to 4.2). However be carreful when you're doing this, you need to backup first everything in your MAMP/htdoc folder. Also keep a backup of your custom compiled php version than can live in MAMP/bin/php. (In my case I had a special PHP version with Oracle drivers).
Also if you configured the MAMP php version to be your CLI php interpreter, you'll need to update the PATH in your .bash_profile
It should look something like this :
export PATH=/Applications/MAMP/bin/php/php7.1.8/bin:$PATH
I hope this can help.
I got this problem after updating MAMP, and the custom $PATH I had set was wrong because of the new php version, so the wrong version of php was loaded first, and it was that version of php that triggered the error.
Updating the path in my .bash_profile fixed my issue.
In my case it was libjpeg
. All I had to do was run brew reinstall libjpeg
and everything just worked!
I suggest you run:
$ brew update && brew upgrade
Until couple of minutes ago I had this problem, too. Because I have an up to date PHP version, I solved it with:
$ brew reinstall php55
Hope that helps.