title: Resolved: MAMP Php can't exec ('convert') after Homebrew ImageMagick install
body: <p>I installed Imagemagick using Homebrew on Lion, everything is fine except that it doesn't work at all when being called from php. Console:</p>
  
  <pre><code>$ convert -version
  Version: ImageMagick 6.7.1-1 2011-07-29 Q16 http://www.imagemagick.org
  Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
  Features: OpenMP   
  
  $ which convert
  /usr/local/bin/convert
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>echo exec ('convert -version');
  </code></pre>
  
  <p>or
      exec('convert -version', $output);
      var_dump($output);</p>
  
  <p>Produces nothing (or an empty array).</p>
  
  <pre><code>exec ('/usr/local/bin/convert') // works, but
  exec ('which convert') // doesn't
  </code></pre>
  
  <p>I need to test this locally to make sure I can detect convert in production environment. But I can't properly test it. The PATH is set and it works in Terminal, but not from PHP.</p>
  
  <p><strong>Resolved:</strong></p>
  
  <p>Turns out, for php to work <code>convert</code> should be in <code>/usr/bin/</code> so this solved it:</p>
  
  <pre><code>ln -s /usr/local/bin/convert /usr/bin/convert
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>It was becasue of MAMP, here is the fix: <a href="http://firedevcom.tumblr.com/post/22791937644/fix-for-homebrew-imagemagick-and-mamp" rel="noreferrer">http://firedevcom.tumblr.com/post/22791937644/fix-for-homebrew-imagemagick-and-mamp</a></p>
  
  <p>Open /Applications/MAMP/Library/bin/envvars</p>
  
  <p>And comment out the following lines:</p>
  
  <pre><code>DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
  export DYLD_LIBRARY_PATH
  </code></pre>
  
  <p>Done.</p>