Cannot run a binary executable from PHP and MAMP?

I recently encountered this obscure error when trying to run an external program using PHP (which was bundled with MAMP Pro) on Mac OS X:

dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib

Oddly, other commands execute fine from PHP using shell_exec(). Even more strangely, the external program ran fine when executed from a PHP command-line script, just not from MAMP’s bundled version of Apache!

Thanks to this tidbit from the PrinceXML forums, the solution was easy:

MAMP changes the environment variable $DYLD_LIBRARY_PATH. Check the file:

/Applications/MAMP/Library/bin/envvars

and try out if commenting out the two uncommented lines will work for you.

9 thoughts on “Cannot run a binary executable from PHP and MAMP?

  1. Freddie

    I’m experiencing the same problem. Sadly, changing the envvars file does nothing for me, the same DYLD_LIBRARY_PATH is still set in MAMP (2.0.5) on startup.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>