[CentOS]Install ImageMagick

Install ImageMagick application.

yum update
yum install ImageMagick ImageMagick-devel ImageMagick-perl

If installed successfully, the following command will work:

convert --version

Install ImageMagick module for PHP

yum install gcc make automake php-pear php-devel
pecl install imagick

If using PHP7.0 or later, you have to install php-pear and php-devel which coresspond with that version. For more details, check here.

Add the following line to file “/etc/php.ini”:

extension=imagick.so

Change permission of file imagick.so so it can be executable:

chmod 755 /usr/lib64/php/modules/imagick.so

Restart Httpd and PHP-FPM (if installed):

service httpd restart
service php-fpm restart