dyld: 库未加载: /usr/local/lib/libpng16.16.dylib 与任何与 php 相关的内容

2022-08-30 07:10:25

使用任何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(使用curl安装)

我尝试删除libpng并使用自制软件重新安装,但无济于事。

接下来是切换到最新版本的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

我运行小牛队(10.9.2)和PHP 5.5.1。

提前致谢!


答案 1

我建议你运行:

$ brew update && brew upgrade

直到几分钟前,我也遇到了这个问题。因为我有一个最新的PHP版本,所以我用:

$ brew reinstall php55

希望有所帮助。


答案 2

我遵循了上述内容(无论如何,保持最新的酿造从来都不是一个坏主意),并且仍然有相同的确切问题:

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 相当于定位


推荐