PHP will show the Module “imagick” is already loaded message when you try to load the php_imagick
extension more than once.
The full message is as follows:
PHP Warning: Module "imagick" is already loaded in Unknown on line 0
Many people think this warning comes from their PHP code because the “line 0” part.
But this is actually a PHP configuration issue, so you can’t solve this warning by looking at your source code.
Here are the steps required to fix the issue:
Step #1: Find your php.ini location
You can find the location of your php.ini
file by calling the phpinfo()
function as shown below:
You need to open the file location in your Explorer window.
Step #2: Find and comment the imagick extension line
Once you open the php.ini
file, search if any of the following lines exist:
extension=imagick.so
; or
extension=php_imagick.dll
; or
extension=imagick
You need to make sure that only one of the lines above is active and comment the rest.
For example, if you already have imagick.so
, then you need to comment the php_imagick.dll
line as follows:
extension=imagick.so
; extension=php_imagick.dll
This way, the imagick
extension won’t be loaded twice.
I recommend you comment the first line of imagick
that you found, then restart your Apache server.
This time, the warning message should disappear.
And that’s how you solve the PHP Warning: Module “imagick” is already loaded in Unknown on line 0.