Install ImageMagick (Imagick) on Centos 8
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
Install Support Repositories
At first, we need to install & enable the EPEL repository:
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -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 "extension=imagick.so" > /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.
Md Obydullah
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.