ImageMagick在命令行中工作,但在php中执行exec()时,它返回5与“不兼容的库版本”


ImageMagick works in command line but when exec() in php it returns 5 with "incompatible library version"

我在OS x上使用php 5.3.6和ImageMagick(命令行)使用MAMP(和Macports)时遇到了一个奇怪的问题。

当我从CLI中运行identify命令时,它工作正常。但是,当我使用exec()运行完全相同的命令时,它返回的值代码为5,并且在apache错误日志中我有:

dyld: Library not loaded:/opt/local/lib/libfreettype .6.dylib
引用路径:/opt/local/bin/identify原因:不兼容库版本:identify需要14.0.0或更高版本,但是libfreetype.6。Dylib提供13.0.0版本

。cli命令为:/opt/local/bin/identify /Users/leonardteo/Documents/1.jpg

从命令行执行时效果很好。当从PHP执行时:

exec("/opt/local/bin/identify /Users/leonardteo/Documents/1.jpg", $output, $return);

$return5

$output is nothing

检查apache日志,libfreetype出现上述问题。

我使用Macports安装ImageMagick。我还尝试了从源代码和运行/usr/local/bin/identify标识的手动构建,我得到了相同的结果。我也试过从Macports而不是MAMP运行PHP,我得到了相同的结果。

有人能帮我解释一下吗?

编辑此文件:

/应用程序/MAMP/图书馆/bin/envvars

注释掉以下行:

DYLD_LIBRARY_PATH ="/应用程序/MAMP/图书馆/lib: DYLD_LIBRARY_PATH&quot美元;

出口DYLD_LIBRARY_PATH