How to Install ImageMagick (Imagick) Extension on RHEL / Centos 7

In this article, I’m going to show how to install the Imagick PHP extension on RHEL/CentOS 7. Let’s get started:

Table of Contents

  1. Install Support Repositories
  2. Install Imagick
  3. Check Imagick

Install Support Repositories

The imagick is available on the REMI repository. So, we need to install this repository:

sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

There is another popular repo call EPEL. You can try without EPEL. If some packages don’t find, then install EPEL:

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install Imagick

We need to install php-pear, php-devel and gcc packages to compile imagick PHP extension:

sudo yum install php-pear php-devel gcc

After installing the prerequisites, run this command to install Imagick:

sudo yum install php-pecl-imagick

Then go to /etc/php.d folder and search for imagick.ini file. You may find the file like 20-imagick.ini or 40-imagick.ini. After finding the file, run this command:

# replace imagick.ini with your own filename.
echo "extension=imagick.so" > /etc/php.d/imagick.ini

Check Imagick

Let’s try to find Imagick in phpinfo():

That’s all. Thank you. ?

Software Engineer | Ethical Hacker & Cybersecurity...

Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.