Solve PHP Warning: Module 'imagick' is already loaded

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:
; or
; or

You need to make sure that only one of the lines above is active and comment the rest.

For example, if you already have, then you need to comment the php_imagick.dll line as follows:
; 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.

Take your skills to the next level ⚡️

I'm sending out an occasional email with the latest tutorials on programming, web development, and statistics. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.