# Install Imagick EA-PHP on AlmaLinux 8/9/10: cPanel Setup

Source: https://srvscripts.com/guides/install-imagick-ea-php-almalinux/
Updated: 2026-10-03
Publisher: srvScripts (https://srvscripts.com/)

In short: Install the libraries with dnf install ImageMagick ImageMagick-devel -y, then in WHM » Software » Module Installers » PHP PECL click Manage next to each PHP version and install imagick, or run /opt/cpanel/ea-php84/root/usr/bin/pecl install imagick per version.

WordPress, Nextcloud and most PHP galleries prefer Imagick over GD because it handles large images, PDFs and colour profiles properly, and the WordPress Site Health page nags whenever it is missing. On a cPanel server the extension is not part of the EasyApache 4 package set, so it has to be compiled through PECL against each installed PHP version, and the system ImageMagick libraries must be present first. On CloudLinux there is a further step, because users inside CageFS cannot see a freshly built module until the skeleton is refreshed. The procedure below covers AlmaLinux 8, 9 and 10 and their CloudLinux equivalents.

**Short answer:** Install the libraries with `dnf install ImageMagick ImageMagick-devel -y`, then in WHM » Software » Module Installers » PHP PECL click Manage next to each PHP version and install `imagick`, or run `/opt/cpanel/ea-php84/root/usr/bin/pecl install imagick` per version. On CloudLinux run `cagefsctl --force-update` so users see the module, restart PHP-FPM with `/scripts/restartsrv_cpanel_php_fpm`, and verify with `/opt/cpanel/ea-php84/root/usr/bin/php -m | grep imagick`.

## Install the ImageMagick libraries

The PECL build needs the headers and the `MagickWand-config` tool provided by the development package. On AlmaLinux and CloudLinux 8, 9 and 10:

```
dnf install ImageMagick ImageMagick-devel -y
MagickWand-config --version
```

On AlmaLinux 8 the packages come from the standard repositories; on 9 and 10 they may live in the EPEL or CRB repositories, so enable those first with `dnf config-manager --set-enabled crb` and `dnf install epel-release` if the install reports nothing to do. Ubuntu 24.04 servers use `apt install imagemagick libmagickwand-dev` instead. Also make sure the EA4 development packages for each PHP version are present, since PECL needs `phpize` and the compiler: `dnf install ea-php84-php-devel gcc make -y`, repeating for each version in use.

## Build the extension for each PHP version

The WHM route is Software » Module Installers, then PHP PECL and the Manage button for a version. Type `imagick` in the install box and submit; the page shows the compiler output and reports success or the missing dependency. Repeat for every PHP version accounts actually use, which you can list with `whmapi1 php_get_vhost_versions` or the MultiPHP Manager page.

The command-line route is faster when several versions are involved:

```
for v in 82 83 84 85; do
  /opt/cpanel/ea-php$v/root/usr/bin/pecl install imagick
  echo 'extension=imagick.so' > /opt/cpanel/ea-php$v/root/etc/php.d/40-imagick.ini
done
```

PECL prompts for the ImageMagick installation prefix; press Enter to autodetect. Adjust the version list to what is installed under `/opt/cpanel/`. If the build fails with a message about the ImageMagick version being too new or too old for the imagick release, install a specific extension version such as `pecl install imagick-3.7.0` and check the PECL changelog for the combination your PHP release supports; PHP 8.5 in particular may need the latest imagick release.

## CloudLinux and CageFS

On CloudLinux the module exists on the host but users inside CageFS run against a skeleton copy of the system paths. Refresh it after every PECL build, and if PHP Selector is in use, enable the extension there too so it appears in user-selectable modules:

```
cagefsctl --force-update
cloudlinux-selector get --json --interpreter php | grep -c imagick
```

In WHM » CloudLinux LVE Manager » Selectors » PHP, tick imagick for the versions you built and save. Without this step a user running `php -m` inside their shell or a WordPress health check reports the module missing while root sees it.

## Restart and verify

PHP-FPM caches the loaded module list, so restart it and Apache:

```
/scripts/restartsrv_cpanel_php_fpm
/scripts/restartsrv_httpd
/opt/cpanel/ea-php84/root/usr/bin/php -m | grep imagick
/opt/cpanel/ea-php84/root/usr/bin/php -r 'echo Imagick::getVersion()["versionString"], PHP_EOL;'
```

The second command prints the ImageMagick library version the extension was linked against. As a final check, place a small PHP file in an account with `phpinfo();` and load it in a browser; the imagick section should show supported formats including PDF if Ghostscript is installed. WordPress Site Health under Tools should no longer list the missing module.

## Pitfalls

The most common problem is that a later EasyApache 4 update replaces PHP packages and the compiled `imagick.so` no longer matches the new PHP API version, producing a warning in the PHP error log and a silently missing module. Rebuild with PECL after major PHP package updates, or watch for the warning in `/opt/cpanel/ea-php84/root/var/log/php-fpm/error.log`. Also note that the ImageMagick policy file at `/etc/ImageMagick-6/policy.xml` or the version-7 equivalent restricts PDF and PostScript handling by default; edit the policy rather than disabling it entirely if an application needs PDF thumbnails.

## Install Imagick EA-PHP at a glance

**Official documentation:** [CloudLinux documentation](https://docs.cloudlinux.com/), [cPanel & WHM documentation](https://docs.cpanel.net/), [AlmaLinux wiki](https://wiki.almalinux.org/).

**Related guides:** [Whitelist IPs and countries in Imunify360 from the CLI](https://srvscripts.com/guides/imunify360-whitelist-ip-cli/) · [Imunify360 in 2026: WAF by default, L7 rate limiting and Under Attack Mode tuning](https://srvscripts.com/guides/imunify360-under-attack-mode-2026/) · [Fixing /scripts/upcp failures, tier blockers and “Upgrade blocked” on an unsupported OS](https://srvscripts.com/guides/cpanel-upcp-failed-upgrade-blocked/).

## Frequently asked questions

### Does installing imagick for EA-PHP also work on Ubuntu cPanel servers?

Yes. The PECL and WHM Module Installer steps are identical; only the library install changes to `apt install imagemagick libmagickwand-dev`, and CageFS applies only to CloudLinux.

### How long does building imagick for four PHP versions take?

Each PECL build compiles in under a minute on typical hardware, so allow five to ten minutes for all versions including the CageFS update and service restarts.

### Can I undo the installation if a site misbehaves?

Yes. Remove the `40-imagick.ini` file for that PHP version or run `pecl uninstall imagick` under the same prefix, then restart PHP-FPM. On CloudLinux untick the module in the PHP Selector and update CageFS again.
