ImageMagick在命令行中工作但是当php中的exec()时,它返回带有“不兼容的库版本”的5。 [英] ImageMagick works in command line but when exec() in php it returns 5 with "incompatible library version"

查看:151
本文介绍了ImageMagick在命令行中工作但是当php中的exec()时,它返回带有“不兼容的库版本”的5。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OS X上使用MAMP(以及Macports,我试过两个)的php 5.3.6和ImageMagick(命令行)有一个奇怪的问题。

I'm having a bizarre problem with php 5.3.6 and ImageMagick (command line) using MAMP (and Macports too..I tried both) on OS X.

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

When I run the identify command from the CLI, it works fine. But when I run the exact same command using exec(), it returns a value code of 5 and in the apache error logs I have:


dyld:未加载库:/opt/local/lib/libfreetype.6.dylib

引自:/ opt / local / bin / identify原因:不兼容
库版本:识别需要版本14.0.0或更高版本,但
libfreetype.6.dylib提供版本13.0.0

dyld: Library not loaded: /opt/local/lib/libfreetype.6.dylib
Referenced from: /opt/local/bin/identify Reason: Incompatible library version: identify requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0

例如
cli命令是:
/ opt / local / bin / identify /Users/leonardteo/Documents/1.jpg

从命令行执行时,这很好用。从PHP执行时:

This works just fine when executed from the command line. When executed from PHP:

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

$ return 5

$ output 什么都不是

检查apache日志会给出libfreetype的上述问题。

Checking the apache logs gives the above issue with libfreetype.

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

I installed ImageMagick using Macports. I've also tried a manual build from source and running identify from /usr/local/bin/identify and I get the same result. I have also tried running PHP from Macports instead of MAMP and I get the same result.

有人可以帮忙解释一下吗?

Could someone please help shed light on this?

推荐答案

编辑此文件:


/ Applications / MAMP / Library / bin / envvars

/Applications/MAMP/Library/bin/envvars

注释掉以下几行:


DYLD_LIBRARY_PATH =/ Applications / MAMP / Library / lib:$ DYLD_LIBRARY_PATH

DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"

export DYLD_LIBRARY_PATH

export DYLD_LIBRARY_PATH

这篇关于ImageMagick在命令行中工作但是当php中的exec()时,它返回带有“不兼容的库版本”的5。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆