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.
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: 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
E.g.
The cli command is:
/opt/local/bin/identify /Users/leonardteo/Documents/1.jpg
This works just fine when executed from the command line. When executed from PHP:
exec("/opt/local/bin/identify /Users/leonardteo/Documents/1.jpg", $output, $return);
$return
is 5
$output
is nothing
Checking the apache logs gives the above issue with libfreetype.
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?
Edit this file:
/Applications/MAMP/Library/bin/envvars
Comment out the following lines:
DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With