If you’re running MAMP and you’ve finally managed to get the Imagick extension to add ImageMagick support compiled, the battle may not be over yet. There are more things you need to do. You might get an error similar to the following.
Firstly, imagick.so was probably installed into the sytem’s PHP extension directory. So you might need to copy this into MAMP’s directory. Don’t just copy and paste the code below as you need to check the paths are correct for your system.
php -i | grep extension_dir
Secondly, some of the libraries are out of date. You might get an error like the following.
[01-Jun-2012 08:46:22] PHP Warning: PHP Startup: Unable to load dynamic library
- dlopen(/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/imagick.so, 9): Library not loaded: /opt/local/lib/libjpeg.8.dylib
Referenced from: /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/imagick.so
Reason: Incompatible library version: imagick.so requires version 13.0.0 or later,
but libjpeg.8.dylib provides version 12.0.0 in Unknown on line 0
[01-Jun-2012 08:51:54] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/yaml.so' - dlopen(/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/yaml.so, 9):
image not found in Unknown on line 0
We can solve this by editing a configuration file.
sudo vim /Applications/MAMP/Library/bin/envvars
Comment out the first two lines below and add the last one.
This should override out of date libraries such as libjpeg. If you’re still having problems, you can manually copy in the freetype library too.
cp /opt/local/lib/libfreetype.6.dylib /Applications/MAMP/Library/lib/
Though in theory this step should not be required. Restart Apache and you should see Imagick appear on the phpinfo() output.