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.
yum install ImageMagick*
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’ failedLuckily 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/imagick.so’ 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://pecl.php.net/imagick-3.1.2 configuration option “php_ini” is not set to php.ini location You should add “extension=imagick.so” to php.ini
- Add “extension=imagick.so” to php.ini.
- 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
- 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/domain.name/etc/php.ini
To resolve, I created imagick.ini in /etc/php.d with the following content:
; Enable imagick extension module extension=imagick.so
I then removed the extension from inside the default php.ini file (step 3) to clean things up.
- One last restart!
service httpd graceful
- 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!