programing tip

dyld : 라이브러리가로드되지 않음 : PHP 관련 항목이있는 /usr/local/lib/libpng16.16.dylib

itbloger 2020. 7. 18. 10:39
반응형

dyld : 라이브러리가로드되지 않음 : PHP 관련 항목이있는 /usr/local/lib/libpng16.16.dylib


PHP 응용 프로그램을 사용하면 다음과 같은 결과가 발생합니다.

dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
[1]    4494 trace trap  php

내 PHP 응용 프로그램의 대부분은 composer를 제외하고 homebrew를 사용하여 설치되었습니다 (curl을 사용하여 설치)

libpng를 제거하고 homebrew로 다시 설치하려고했지만 아무 소용이 없습니다.

다음은 오류 메시지에 명시된대로 최신 버전의 libpng 1.5로 전환하는 것입니다.

$ brew info libpng
libpng: stable 1.6.10 (bottled) 
http://www.libpng.org/pub/png/libpng.html
/usr/local/Cellar/libpng/1.5.17 (15 files, 1.0M)
Poured from bottle
/usr/local/Cellar/libpng/1.5.18 (15 files, 1.0M)
Poured from bottle
/usr/local/Cellar/libpng/1.6.10 (17 files, 1.3M) *

$ brew switch libpng 1.5.18
Cleaning /usr/local/Cellar/libpng/1.5.17
Cleaning /usr/local/Cellar/libpng/1.5.18
Cleaning /usr/local/Cellar/libpng/1.6.10
16 links created for /usr/local/Cellar/libpng/1.5.18

이제 오류가 다음과 같이 변경되었습니다.

dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib
Referenced from: /usr/local/lib/libfreetype.6.dylib
Reason: image not found
[1]    6993 trace trap  phpunit

Mavericks (10.9.2) 및 PHP 5.5.1을 실행 중입니다.

미리 감사드립니다!


나는 당신이 실행하는 것이 좋습니다 :

$ brew update && brew upgrade

몇 분 전까지이 문제도있었습니다. 최신 PHP 버전이 있으므로 다음과 같이 해결했습니다.

$ brew reinstall php55

희망이 도움이됩니다.


나는 위의 내용을 따르고 (어쨌든 맥주를 최신 상태로 유지하는 나쁜 생각은 결코) 결코 똑같은 문제가있었습니다.

LAPTOP:folder Username$ php -v
dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Trace/BPT trap: 5

그런 다음 더 간단한 방법을 알아 냈습니다.

상자에서 libpng 버전을 검색하십시오.

# Requires locate & updatedb for mac os x
# See Link [1] 
LAPTOP:folder Username$ locate libpng15.15.dylib
/Applications/GIMP.app/Contents/Resources/lib/libpng15.15.dylib
/usr/X11/lib/libpng15.15.dylib
/usr/local/Cellar/libpng/1.5.14/lib/libpng15.15.dylib

심볼릭 링크를 만드십시오 :

LAPTOP:folder Username$ ln -s /usr/local/Cellar/libpng/1.5.14/lib/libpng15.15.dylib /usr/local/lib/libpng15.15.dylib

다시 시도하십시오:

LAPTOP:folder Username$ php -v
PHP 5.3.26 (cli) (built: Aug 25 2013 16:07:23) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

1) Mac OS X equivalent of locate


It's because there's no symlinks for libpng. You need to link libpng again.

brew unlink libpng && brew link libpng

And you may get some error. I fixed that error by correcting permission. Maybe it's because of uninstalled macports.

sudo chown -R yourid:staff /usr/local/share/man/

Create link again and it'll work.


I solved this by copying it over to the missing directory:

cp /opt/X11/lib/libpng15.15.dylib /usr/local/lib/libpng15.15.dylib

brew reinstall libpng kept installing libpng16, not libpng15 so I was forced to do the above.


In my case it was libjpeg. All I had to do was run brew reinstall libjpeg and everything just worked!


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 know this question has already an answer that gives a solution. But I want to give you my two cents to help people to understand the problem. Getting same issue I've created a specific question. I got same problem, but only with PHPStorm. And exactly when I try to run test from the editor.

dyld is the dynamic linker

I sow that dyld was looking for /usr/local/lib/libpng15.15.dylib but inside my /usr/local/lib/ there was not. In that folder, I got libpng16.16.dylib.

Thanks to a comment, I undestand that my /usr/bin/php was a pointer to php 5.5.8. Instead, ... /usr/local/bin/php was 5.5.14. PHPStorm worked with /usr/bin/php that is default configuration. When I run php via console, I run /urs/local/bin/php.

So, ... If you get some dyld error, maybe you have some wrong php configuration. That's the reason because

$ brew update && brew upgrade
$ brew reinstall php55

But I dont know why this do not solve the problem to me. Maybe because I have


I also had this problem, and none of the solutions in this thread worked for me. As it turns out, the problem was that I had this line in ~/.bash_profile:

alias php="/usr/local/php/bin/php"

And, as it turns out, /usr/local/php was just a symlink to /usr/local/Cellar/php54/5.4.24/. So when I invoked php -i I was still invoking php54. I just deleted this line from my bash profile, and then php worked.

For some reason, even though php55 was now running, the php.ini file from php54 was still loaded, and I received this warning every time I invoked php:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.38/lib/php/extensions/no-debug-non-zts-20100525/memcached.so' - dlopen(/usr/local/Cellar/php54/5.4.38/lib/php/extensions/no-debug-non-zts-20100525/memcached.so, 9): image not found in Unknown on line 0

To fix this, I just added the following line to my bash profile:

export PHPRC=/usr/local/etc/php/5.5/php.ini

And then everything worked as normal!


I had this error that wasn't solved by brew update && brew upgrade. For some reason I needed to install it from scratch:

$ brew install libpng


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 :

  • /usr/local/lib/libpng16.16.dylib
  • /usr/local/Cellar/libpng/1.6.34/lib/libpng16.16.dylib
  • /Applications/MAMP/Library/lib/libpng16.16.dylib
  • /opt/X11/lib/libpng16.16.dylib

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.

참고URL : https://stackoverflow.com/questions/22631026/dyld-library-not-loaded-usr-local-lib-libpng16-16-dylib-with-anything-php-rel

반응형