ImageMagick, MacPorts and MAMP

After installing ImageMagick from MacPorts, I ran into the following error in my MAMP Apache error log when trying to run PHP code that resized images:

Symbol not found: __cg_jpeg_resync_to_restart

To solve this, edit /Applications/MAMP/Library/bin/envvars to read:

export DYLD_FALLBACK_LIBRARY_PATH=/Applications/MAMP/Library/lib


That basically worked for me.

I had to add the following to the top of the doc:

and changed
export DYLD_FALLBACK_LIBRARY_PATH=/Applications/MAMP/Library/lib

to read:

export DYLD_FALLBACK_LIBRARY_PATH="/Applications/MAMP/Library/lib"

The recommended solution did not work for me. The only way that I could get IM to work was to put /opt/local/lib at the front of DYLD_LIBRARY_PATH.. but then, Apache would not launch properly in MAMP (and no error in the log... so it's a MAMP thing).

This worked for me:

if(stristr($_SERVER['SERVER_NAME'],'localhost') !== FALSE)

Just before the call to IM. I did not need to make any changes to envars. The solution that worked for me relies on safe_mode being off.

Hope this helps someone.