Symptoms
You see these errors appearing in PHP's log files:
ERROR - 17/08/2020 18:48:48 --> Severity: Core Warning --> Module 'imagick' already loaded Unknown 0
ERROR - 17/08/2020 18:48:48 --> Severity: Core Warning --> Module 'imagick' already loaded Unknown 0
ERROR - 17/08/2020 18:48:49 --> Severity: Core Warning --> Module 'imagick' already loaded Unknown 0
ERROR - 17/08/2020 18:48:49 --> Severity: Core Warning --> Module 'imagick' already loaded Unknown 0
ERROR - 17/08/2020 18:48:49 --> Severity: Core Warning --> Module 'imagick' already loaded Unknown 0
Description
This usually means that the module has been loaded more than one time i.e. there are at least two instances of the directive that loads the module in PHP's configuration files. This can occur when the module has been installed multiple times using different utilities (yum, pecl, etc). In our case the directive looks like this:
extension="imagick.so"
Workaround
First, we need to identify what PHP version the domain (AKA VHost) is using. You can run this command to confirm the PHP version the domain is assigned to:
uapi --user=$USER LangPHP php_get_vhost_versions | egrep -i domain -A 1
Here $USER must be replaced with the name of the user the domain belongs to. The output looks like this:
uapi --user=cptest LangPHP php_get_vhost_versions | egrep -i domain -A 1
domain: foo.testing.com
version: ea-php72
--
domain: sub.cptest.net
version: ea-php72
--
domain: foo1.bar1.com
version: ea-php72
You will see the PHP version each domain is using listed underneath the domain name. Now you need to go to this location:
cd /opt/cpanel/ea-php##/root/etc
Don't forget to change the PHP version (ea-php##) in the above path with the domain's PHP. And now if you recursively search for the module-loading directive from above, you should see more than one line showing up:
grep -ir imagi *
php.d/zzzzzzz-pecl.ini:extension="imagick.so"
php.d/imagick.ini:extension=imagick.so
You need to edit one of these files and comment out the line where the directive appears and then restart the PHP-FPM service from the WHM > Restart Services > PHP-FPM service for Apache interface. The error messages should now disappear.