How to install ImageMagick on my AlmaLinux

When I try to instrall imagick for php 8.0 (also for other versions as well) I am getting this error

Last metadata expiration check: 1:28:03 ago on Mon Sep 26 05:27:45 2022.
(try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)
PHP Extension Installed.

But nothing is installing.

Do few think run the upgrade command and run this command with --skip-broken

Which command?

I tried to install from “Install Extensions” under PHP settings. I did not run any command.

Anyway, when I tried to run sudo yum update

I am getting this error, maybe this is a reason.
“Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/litespeed.repo; C
onfiguration: OptionBinding with id “failovermethod” does not exist
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/litespeed.repo; C
onfiguration: OptionBinding with id “failovermethod” does not exist
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/litespeed.repo; C
onfiguration: OptionBinding with id “failovermethod” does not exist
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/litespeed.repo; C
onfiguration: OptionBinding with id “failovermethod” does not exist
Last metadata expiration check: 2:13:56 ago on Mon 26 Sep 2022 05:27:45 AM UTC.
Dependencies resolved.
Nothing to do.
Complete!”

As of 2024, CyberPanel 2.3, AlmaLinux9 Imagick is still not installed via PHP → Install extensions and you need to look for manual installation methods.

How install ImageMagick for WordPress with PHP8.3 on CentOs/AlmaLinux (8/9) ?

sudo dnf install ImageMagick #AlmaLinux
sudo dnf install ImageMagick-devel #AlmaLinux
sudo yum install ImageMagick #CentOS
sudo yum install ImageMagick-devel #CentOS
wget https://pecl.php.net/get/imagick-3.7.0.tgz
tar -zxvf imagick-3.7.0.tgz
cd imagick-3.7.0
sudo /usr/local/lsws/lsphp83/bin/phpize
./configure --with-imagick=/usr/local/lsws/lsphp83 --with-php-config=/usr/local/lsws/lsphp83/bin/php-config
make
sudo make install

We got directions:

Installing shared extensions:     /usr/local/lsws/lsphp83/lib64/php/modules/
Installing header files:          /usr/local/lsws/lsphp83/include/php/

Need add imagick.so to php.ini:

sudo echo "extension=imagick.so" >> /usr/local/lsws/lsphp83/etc/php.d/40-imagick.ini
cat /usr/local/lsws/lsphp83/etc/php.d/40-imagick.ini

Restart php and web-server:

sudo touch /usr/local/lsws/admin/tmp/.lsphp_restart.txt
sudo systemctl restart lsws

Confirm that imagick php-ext installed:

/usr/local/lsws/lsphp83/bin/php -m | grep imagick
/usr/local/lsws/lsphp83/bin/php --ini

And now confirm in phpinfo.php of your website:

cd public_html
nano phpinfo.php

add:

<?php

phpinfo();

?>

CTRL+O and check URL: xhttps://domain.com/phpinfo.info

CTR+F and find imagick

dont forget rm phpinfo.php