Skip to main content

cPanel EasyApache 4 Installing Imagemagick and imagick PHP extension

This is a quick guide on how to install both the imagick PHP extension as well as the application via SSH.

Justin Catello avatar
Written by Justin Catello
Updated over 3 months ago

ImageMagick is a powerful image manipulation tool used to create, edit, and convert bitmap images in various formats. When paired with the imagick PHP extension, it enables seamless integration of image handling within PHP applications. Whether you're working with dynamic image resizing, file format conversion, or advanced image processing features, ImageMagick provides a comprehensive solution. In this guide, we’ll walk you through the process of installing ImageMagick and the imagick PHP extension using cPanel’s EasyApache 4, making it easier to enhance your website’s media capabilities.

This is fairly simple, just copy and paste the following into SSH.

1. Installing imagemagick:

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

2. Installing the imagemagick PHP extensions for all installed PHP versions.

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

3.  Test to make sure imagemagick is installed:

/usr/bin/convert --version

4. Test to make sure the PHP extensions loaded:

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
PHP 54
imagick
PHP 55
imagick
PHP 56
imagick
PHP 70
imagick
PHP 71
imagick



Did this answer your question?