Working Ninja
ImageMagick on CentOS 5 on Media Temple

Here’s the process I followed to get ImageMagick installed on a CentOS 5 DV Server over at Media Temple. I needed ImageMagick to convert PDFs to JPG files.

  1. yum install ImageMagick*
  2. pecl install imagick

    Here’s where I encountered the first hiccup:

    shtool at ‘/var/tmp/imagick/build/shtool’ does not exist or is not executable. Make sure that the file exists and is executable and then rerun this script.
    ERROR: `phpize’ failed

    Luckily I found someone with a similar issue. The fix was to create a different temp folder for pear to use. Steps as follows:

    mkdir rw /tmp2

    pear config-set temp_dir /tmp2

    pecl install imagick

    Build process completed successfully Installing ‘/usr/lib64/php/modules/’ Installing ‘/usr/include/php/ext/imagick/php_imagick_shared.h’ Installing ‘/usr/include/php/ext/imagick/php_imagick.h’ Installing ‘/usr/include/php/ext/imagick/php_imagick_defs.h’ install ok: channel:// configuration option “php_ini” is not set to php.ini location You should add “” to php.ini

  3. Add “” to php.ini.
  4. Verify install was successful and ImageMagick is loaded into PHP.

    service httpd graceful

    php -m | grep imagick (should output imagick)

    php -r "print(class_exists('imagick'));" (should output 1)

    rm -rf /tmp2

  5. After confirming that ImageMagick was installed and loaded into PHP, I still had the following error in my application:

    Fatal error: Class ‘imagick’ not found

    Found that the PHP file loaded was different than the default php.ini:

    Loaded Configuration File /var/www/vhosts/system/

    To resolve, I created imagick.ini in /etc/php.d with the following content:

    ; Enable imagick extension module

    I then removed the extension from inside the default php.ini file (step 3) to clean things up.

  6. One last restart! service httpd graceful
  7. Check for ImageMagick again via phpinfo() at the domain your application is running on =)

This is a pretty rough outline so if you have any questions, please let me know in a comment below. Thanks!