php error: Class 'Imagick' not found

php error: Class 'Imagick' not found

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

php error: Class 'Imagick' not found

When PHP throws a Class 'Imagick' not found error, it indicates that the runtime environment cannot locate the Imagick extension required to interface with ImageMagick. This is frequently encountered when integrating image processing libraries into web applications. The error usually stems from one of two distinct issues: the ImageMagick library itself is not installed on the server, or the PHP extension that bridges PHP and ImageMagick is missing from the configuration.

In many Linux distributions, installing the system package for ImageMagick (e.g., yum install ImageMagick) does not automatically install the PHP bindings. The system libraries provide command-line access via convert, but PHP requires a specific compiled extension to use these capabilities directly within scripts. You will often see the error persist even after adding extension=imagick to your php.ini file. This happens because the .so file corresponding to that extension does not exist in the expected directory, or PHP is attempting to load an extension for a version of ImageMagick that was not compiled against the current PHP build.

To resolve this, you must ensure the Imagick extension is properly compiled and linked. On RHEL-based systems like Fedora, the package name often differs from the core library. Instead of just installing ImageMagick, you need to install the specific PHP development packages. The command should target the extension itself:

sudo yum install php-imagick

If you are managing a custom build or a shared hosting environment without root access, you might need to download the Imagick source code and compile it against your existing PHP installation. This involves running phpize, configuring the build with your specific PHP path, and compiling the extension before copying the resulting .so file to the extension_dir.

Once the package or compiled extension is present, the next step is verification. Restarting Apache alone does not guarantee the change takes effect; you must confirm that PHP is actually reloading the configuration. Execute the following command in your terminal:

php -m | grep imagick

If the imagick module appears in the output, the binary extension is loaded. However, if you still see the error, check for syntax errors in your php.ini. Ensure the line extension=imagick is uncommented and that there are no typos preventing the parser from reading it. Remember that some hosting environments or older PHP versions (like the 5.2.6 mentioned in similar cases) may have deprecated the extension or require specific flags to enable it.

There is also a critical distinction between the system ImageMagick version and the one expected by the PHP extension. The PECL Imagick extension often relies on specific header files and shared libraries. If you upgraded ImageMagick via yum but did not reinstall the PHP extension, or if you installed an older version of ImageMagick after compiling a new extension, the binaries will be incompatible. Always ensure that the major version numbers match between the system library and the PHP extension requirements.

For developers using modern stacks like Laravel, ensuring these dependencies are managed via Composer can simplify the process, but it does not replace the need for the underlying C-extension to be installed on the server. If you are deploying code where you cannot install system packages, consider switching to a pure PHP image library like GD2 or Gmagick, which do not rely on the external ImageMagick binaries and thus avoid the Class 'Imagick' not found error entirely.

Our network