Issue: Currently Easy Apache 4 (EA4), has no option to install ImageMagick. As of this entry, ImageMagick supports PHP versions 7.3 and 7.4
The following is one example for a server using WordPress over CentOS/cPanel with PHP 7.3
yum install ImageMagick ImageMagick-devel pcre-devel
Let’s make sure one of the required directives are not disabled:
grep disable_function /opt/cpanel/ea-php*/root/etc/php.ini
If you see “popen” edit the “disable_functions” directive in php.ini and remove: popen
Restart http and php-fpm
Install imagick for the specific PHP version used (in this case PHP 7.3.x):
/opt/cpanel/ea-php73/root/usr/bin/pecl install imagick
If you receive this prompt: Please provide the prefix of Imagemagick installation [autodetect] : simply press Enter to allow for autodetection. Do not enter a prefix.
Verify the installation:
grep imagick /opt/cpanel/ea-php*/root/etc/php.d/*.ini
If the appropriate version is not seen “extension=imagick.so” (for your PHP version 7.3.x) then it can be added using the command:
echo 'extension=imagick.so' >> /opt/cpanel/ea-php73/root/etc/php.d/imagick.ini
Caveat: Make SURE it’s only added once, otherwise errors will be logged (simply remove the extra entries to fix this).
Ensure (double check) the popen directive is added back into the disable_functions for the active version of PHP – Don’t forget to do this!
Restart php-fpm and apache
When using the “Site Health” tool in WordPress, it will no longer advise that ImageMagick is unavailable.
Further resources are here:
https://www.interserver.net/tips/kb/how-to-install-imagemagick-extension-on-easyapache4/
here:
https://cloudtech.org/install-imagemagick-imagick-on-cpanel/
and here:
https://serverpilot.io/docs/how-to-install-the-php-imagemagick-extension/
For reference, the most common directives I’ve seen for disable_functions in PHP, is something like this:
disable_functions = show_source, system, shell_exec, passthru, exec, popen, proc_open, phpinfo, parse_ini_file