ImageMagick is an addon for your server which allows image manipulation. ImageMagick is a software suite to create, edit, compose, or convert bitmap images. Imagick is a native PHP extension to create and modify images using the ImageMagick API.
First, install ImageMagick from YUM on CentOS server:
yum install ImageMagick ImageMagick-devel
To check the version:
/usr/bin/convert --version
Second, you need to install imagick module for each PHP version, eg: install imagick for PHP 7.3 from pecl:
/opt/cpanel/ea-php73/root/usr/bin/pecl install imagick
If you disabled popen function in php.ini, you need to temporarily allow it, otherwise, you will get this error:
Warning: popen() has been disabled for security reasons
To check all disabled functions:
grep disable_function /opt/cpanel/ea-php*/root/etc/php.ini
The Imagick PHP Extension should be installed as well, you can verify by:
grep imagick /opt/cpanel/ea-php*/root/etc/php.d/*.ini
If you do not see ‘extension=imagick.so’, you need to manually add it for each PHP version, eg: add imagick extension for PHP 7.3:
echo 'extension=imagick.so' >> /opt/cpanel/ea-php73/root/etc/php.d/imagick.ini
Note that sometimes you may have duplicate entry for ‘extension=imagick.so’, you need to remove one or you will get this in error_log:
PHP Warning: Module ‘imagick’ already loaded in Unknown on line 0
Last, you can verify imagick was installed correctly or not using this command or check in phpinfo page:
/opt/cpanel/ea-php73/root/usr/bin/php -m |grep imagick
[[Category:CPanel]]