Symptoms
When performing an audit of your error logs, you may find log entries such as
PHP Warning: Module 'imagick' already loaded in Unknown on line 0.
This warning could be another module, or on another line, however, the error is generally the same.
Description
This warning is a result of the module having been added more than once, or is in more than one ini file such as zzzzz-pecl as well as the module.ini file. This can occur when the module has been installed through yum and as an additional pecl module.
Workaround
You can use grep
to search the /opt/cpanel/ea-phpXX/etc/php.d
folder for the module that is being loaded multiple times.
As an example, for imagick, we can recursively grep all of the ea-php version in the root/etc folder.
[13:30:50 server root@server /opt]cPs# grep -Ri imagick /opt/cpanel/ea-php*/root/etc
/opt/cpanel/ea-php51/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php51/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php51/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php51/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php52/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php52/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php52/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php52/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php53/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php53/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php53/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php53/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php54/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php54/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php54/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php54/root/etc/php.d/imagick.ini:extension=imagick.so
/opt/cpanel/ea-php54/root/etc/php.d/zzzzzzz-pecl.ini:extension="imagick.so"
When checking the individual files, we can see multiple entries for this module.
[13:30:51 server root@server /opt]cPs# cat /opt/cpanel/ea-php56/root/etc/php.d/imagick.ini
extension=imagick.so
extension=imagick.so
extension=imagick.so
extension=imagick.so
[13:31:31server root@server /opt]cPs# cat /opt/cpanel/ea-php72/root/etc/php.d/imagick.ini
extension=imagick.so
extension=imagick.so
extension=imagick.so
extension=imagick.so
[13:31:39server root@server /opt]cPs# cat /opt/cpanel/ea-php73/root/etc/php.d/zzzzzzz-pecl.ini
extension="imagick.so"
extension="timezonedb.so"
[13:31:48server root@server /opt]cPs# cat /opt/cpanel/ea-php73/root/etc/php.d/imagick.ini
extension=imagick.so
Use your favorite editor from the command line such as vi/vim/pico and remove the additional entries in the files previously found. Be sure to use the restart script/scripts/restartsrv_apache_php_fpm
if PHP-FPM is in use.