ImageMagick is a software suite to create, edit, compose or convert bitmap images. To use this utility in PHP, you'll need to install ImageMagick Linux package and also build and install a PHP extension.
Prerequisite for installing imagick PHP extension is php-pear and gcc packages, so let's get those packages installed.
# yum install php-pear gcc
Now, that you have php-pear and gcc, you may install ImageMagick packages.
# yum install ImageMagick ImageMagick-devel php-devel
# pecl install imagick
Note: You'll not be able to run pecl if you don't have php-pear package installed. To compile imagick, you'll need a GCC compiler as well.
By running the command, you'll install ImageMagick and PHP extension module imagick.so in the /usr/lib/php/modules folder. If you have a 64-bit machine, the modules directory will be /usr/lib64/php/modules.
Edit the /etc/php.d/imagick.ini, and add the following line.
extension=imagick.so
Restart apache, by ...
# service httpd restart
That's all there is to it.
Comments
Confirmed working on Centos 6
You will have to install "php-devel" package in order for it to work in Centos 6.
Confirmed working on Centos 6.4 with PHP 5.3.3 and 5.4.
Add new comment