Install ImageMagick (Imagick) on Centos 8

Published on December 9, 2020 43 sec read

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. Verify Installation

Install Support Repositories

At first, we need to install & enable the EPEL repository:

sudo dnf install -y

Then run this command:

sudo dnf config-manager --set-enabled PowerTools

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

sudo dnf install php-pear php-devel gcc -y

Install Imagick

After installing required packages, let’s install ImageMagick using following command:

sudo dnf install -y ImageMagick ImageMagick-devel

Let’s install imagick PHP support pack:

sudo dnf install php-pecl-imagick -y

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 40-imagick.ini with your own filename.
echo "" > /etc/php.d/40-imagick.ini

Restart web server (optional):

sudo systemctl restart httpd

Verify Installation

Run this command to verify imagick installation:

convert --version
# or
php -r 'phpinfo();' | grep imagick

You can check the PHP modules details from PHPInfo:

That’s all. Thank you. 🙂

Monthly Newsletter

One email a month, packed with the latest tutorials, delivered straight to your inbox.
We'll never send any spam or promotional emails.

Hey, I'm Md Obydullah. I build open-source projects and write on Laravel, Linux server, modern JavaScript and more on web development.