-
Notifications
You must be signed in to change notification settings - Fork 3
Installing ImageMagick on Mac OSX for PHP and MAMP
Ghostscript is going to be doing the actual conversion for ImageMagick
brew install ghostscript
If there is a failure try running
brew updateand then the command again.
ImageMagick must be compiled with ghostscript support to convert PDFs to images.
brew install ImageMagick --with-ghostscript
After the above you should be able to execute
convert -list delegateand see some entries for pdf.
PHP will use ImageMagick through the extension imagick.so
pecl install imagick- Copy the imagick.so file into MAMP's directory:
php --ini | grep "Loaded Configuration Filecat /Applications/MAMP/bin/php/php5.3.6/conf/php.ini | grep extension_dir
If you receive the error:
php_imagick.h:40:10: fatal error: 'php.h' file not foundthen please reference: MAMP doesn’t ship with a bunch of the PHP sources
Configure php.ini to use imagick.
extension=imagick.so
Force MAMP to use system libraries. This may be helpful if you encounter errors such as Symbol not found: __cg_jpeg_resync_to_restart. Comment out references to DYLD_LIBRARY_PATH. This can have unintended consequences!
vi /Applications/MAMP/Library/bin/envvars
Make sure Apache has access to ghostscript. Only if convert runs fine from the command line but fails under php. (http://stackoverflow.com/questions/588918/imagemagick-imagick-convert-pdf-to-jpg-using-native-php-api)
ln -s /usr/local/bin/gs /usr/bin/gs