dyld:库未加载:/usr/local/lib/libpng16.16.dylib 与 php 相关的任何内容
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22631026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib with anything php related
提问by user3458861
Using any php application results in:
使用任何 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
Most of my php applications were installed using homebrew with the exception of composer (installed using curl)
我的大部分 php 应用程序都是使用自制软件安装的,除了 composer(使用 curl 安装)
I tried removing the the libpng and reinstalling with homebrew to no avail.
我尝试删除 libpng 并使用自制软件重新安装无济于事。
Next was to switch to latest version of libpng 1.5 as stated in the error message:
接下来是切换到最新版本的 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
Now the error has changed to:
现在错误已更改为:
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
Im running Mavericks (10.9.2) and PHP 5.5.1.
我正在运行 Mavericks (10.9.2) 和 PHP 5.5.1。
Thanks in advance!
提前致谢!
回答by Pera Jovic
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:
直到几分钟前,我也遇到了这个问题。因为我有一个最新的 PHP 版本,所以我解决了这个问题:
$ brew reinstall php55
Hope that helps.
希望有帮助。
回答by phpguru
I followed the above (never a bad idea to keep up to date with brew anyhow) and still had the same exact issue:
我遵循了上述内容(无论如何与 brew 保持同步从来不是一个坏主意)并且仍然遇到相同的问题:
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
Then figured out a simpler way:
然后想出了一个更简单的方法:
Search for your libpng version(s) on your box:
在您的盒子上搜索您的 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
Make a symlink:
制作符号链接:
LAPTOP:folder Username$ ln -s /usr/local/Cellar/libpng/1.5.14/lib/libpng15.15.dylib /usr/local/lib/libpng15.15.dylib
Try again:
再试一次:
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
回答by Jonghee Park
It's because there's no symlinks for libpng. You need to link libpng again.
这是因为 libpng 没有符号链接。您需要再次链接 libpng。
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.
你可能会得到一些错误。我通过更正权限修复了该错误。可能是因为卸载了 macports。
sudo chown -R yourid:staff /usr/local/share/man/
Create link again and it'll work.
再次创建链接,它将起作用。
回答by user391339
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.
brew restart libpng 继续安装 libpng16,而不是 libpng15,所以我被迫执行上述操作。
回答by saada
In my case it was libjpeg
. All I had to do was run brew reinstall libjpeg
and everything just worked!
就我而言,它是libjpeg
. 我所要做的就是运行brew reinstall libjpeg
,一切正常!
回答by Alex
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:
这导致其他需要 1.5 版本的软件包出现错误,因此我将其链接起来:
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.
现在,他们都和睦相处,并为不同的包裹并肩生活。重建依赖于 1.5 的包会更好,但这可以作为一个快速的绷带修复。
回答by sensorario
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.
我知道这个问题已经有一个给出解决方案的答案。但我想给你我的两分钱来帮助人们理解这个问题。遇到同样的问题我创建了一个特定的问题。我遇到了同样的问题,但仅限于 PHPStorm。而正是当我尝试从编辑器运行测试时。
dyldis the dynamic linker
dyld是动态链接器
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.
我发现 dyld 正在寻找 /usr/local/lib/libpng15.15.dylib 但在我的 /usr/local/lib/ 中却没有。在那个文件夹中,我得到了 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.
感谢评论,我不明白我的 /usr/bin/php 是指向 php 5.5.8 的指针。相反,... /usr/local/bin/php 是 5.5.14。PHPStorm 使用默认配置的 /usr/bin/php。当我通过控制台运行 php 时,我运行 /urs/local/bin/php。
So, ... If you get some dyld error, maybe you have some wrong php configuration. That's the reason because
所以,...如果你得到一些 dyld 错误,也许你有一些错误的 php 配置。这就是原因,因为
$ brew update && brew upgrade
$ brew reinstall php55
But I dont know why this do not solve the problem to me. Maybe because I have
但我不知道为什么这不能解决我的问题。也许是因为我有
回答by Matt Korostoff
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
:
我也遇到了这个问题,该线程中的所有解决方案都不适合我。事实证明,问题是我有这条线~/.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.
而且,事实证明,/usr/local/php
它只是到/usr/local/Cellar/php54/5.4.24/
. 因此,当我调用时,php -i
我仍在调用 php54。我刚刚从我的 bash 配置文件中删除了这一行,然后 php 工作了。
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:
出于某种原因,即使 php55 现在正在运行,php.ini
来自 php54的文件仍然被加载,每次调用 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:
为了解决这个问题,我刚刚在我的 bash 配置文件中添加了以下行:
export PHPRC=/usr/local/etc/php/5.5/php.ini
And then everything worked as normal!
然后一切正常!
回答by osowskit
I had this error that wasn't solved by brew update && brew upgrade
. For some reason I needed to install it from scratch:
我有这个错误没有解决brew update && brew upgrade
。出于某种原因,我需要从头开始安装它:
$ brew install libpng
$ brew install libpng
回答by Kaizoku Gambare
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
原因:库版本不兼容:php需要44.0.0或更高版本,但libpng16.16.dylib提供42.0.0版本 Trace/BPT trap: 6
I did all the above things with brew and much more ... but it wasn't this !
我用 brew 做了以上所有的事情,还有更多……但不是这个!
Check where your library is :
检查您的图书馆在哪里:
sudo find / -name libpng16.16.dylib
须藤查找/-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
- /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
因此,由于我是 MAMP 用户,结果发现在我尝试从 PHP 7.1.0 更新到 7.1.8(最后可用的 MAMP php)时出现错误,因为 Symfony4 至少需要 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).
最后,我安装了新版本的 MAMP,它工作正常(4.1 到 4.2)。但是,在执行此操作时要小心,您需要先备份 MAMP/htdoc 文件夹中的所有内容。还要保留您自定义编译的 php 版本的备份,以便可以在 MAMP/bin/php 中使用。(就我而言,我有一个带有 Oracle 驱动程序的特殊 PHP 版本)。
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
此外,如果您将 MAMP php 版本配置为 CLI php 解释器,则需要更新 .bash_profile 中的 PATH
It should look something like this :
它应该是这样的:
export PATH=/Applications/MAMP/bin/php/php7.1.8/bin:$PATH
导出路径=/Applications/MAMP/bin/php/php7.1.8/bin:$PATH
I hope this can help.
我希望这会有所帮助。