ImageMagick works on the command line, but when exec () in php returns 5 with an "incompatible version of the library",

I had a strange problem with php 5.3.6 and ImageMagick (command line) using MAMP (and Macports too .. I tried both) on OS X.

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

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

eg. Cli command: /opt/local/bin/identify /Users/leonardteo/Documents/1.jpg

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

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

$return 5

$output nothing

Checking the apache logs gives the above problem with libfreetype.

I installed ImageMagick using Macports. I also tried to create a manual assembly from the source and run the identifier from /usr/local/bin/identify , and I get the same result. I also tried to run PHP from Macports instead of MAMP, and I get the same result.

Can someone really help shed light on this?

+7
source share
1 answer

Edit this file:

/ Applications / MAMP / Library / bin / envvars

Comment on the following lines:

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

export DYLD_LIBRARY_PATH

+17
source

All Articles