Install ImageMagick & imagick PHP extension to cPanel

Install ImageMagick & imagick PHP extension to cPanel

Step 1. Install imagemagick on the server:

yum -y install ImageMagick-devel ImageMagick-c++-devel ImageMagick-perl

To check if installed:

/usr/bin/convert --version

Step 2. Install the imagick PHP extension to all PHP versions on the cPanel server:

for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
printf "\autodetect" | /opt/cpanel/$phpver/root/usr/bin/pecl install imagick
echo 'extension=imagick.so' >> /opt/cpanel/$phpver/root/etc/php.d/imagick.ini
done
/scripts/restartsrv_httpd
/scripts/restartsrv_apache_php_fpm

Test if an extension is added to each PHP version:

for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
echo "PHP $phpver" ; /opt/cpanel/$phpver/root/usr/bin/php -m |grep imagick
done
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.