Install imagick on WHM/cPanel

We’ll be going over the steps involved in installing Image Magick and imagick on WHM / cPanel.

Image Magick is an opensource application that let’s you create, change, modify and convert images. From resizing, rotating to creating and splitting PDF’s, Image Magick is extremely versatile and very useful for your application.

You cannot install Image Magick from the EasyApache4 wizard in WHM.

Prerequisites

  • A user with ROOT access or sudo terminal privileges
  • A server running WHM (for this particular case)
  • Approximately 500MB of available diskspace

Install the OS Package

Start off by making sure you have PACKAGE installed. Issues the following at the terminal to install:

yum install pcre-devel

Next we install the Image Magick base package along with it’s developer companion package. Issue the following at the shell terminal

yum install ImageMagick ImageMagick-devel

Install the PHP package

Now that we’ve installed the OS package of ImageMagick we need to install the PHP package so that you can use it via PHP. We’ll install the package via CLI, so run the following commands for every version of PHP you have installed

PHP version 5.6
/opt/cpanel/ea-php56/root/usr/bin/pecl install imagick

PHP version 7.0
/opt/cpanel/ea-php70/root/usr/bin/pecl install imagick

PHP version 7.1
/opt/cpanel/ea-php71/root/usr/bin/pecl install imagick

PHP version 7.2
/opt/cpanel/ea-php72/root/usr/bin/pecl install imagick

PHP version 7.3
/opt/cpanel/ea-php73/root/usr/bin/pecl install imagick

PHP version 7.4
/opt/cpanel/ea-php74/root/usr/bin/pecl install imagick

Finally restart Apache from WHM and you’re done!