Intervention/image · critical · MissingDependencyException
Imagick PHP extension must be installed to use this driver
Error message
Imagick PHP extension must be installed to use this driver
What it means
The Imagick driver's health check found the imagick extension not loaded or the Imagick class absent. It fires as soon as an ImageManager is created with the Imagick driver on a PHP runtime that cannot back it. It is a MissingDependencyException (environment problem), not an image problem.
Source
Thrown at src/Drivers/Imagick/Driver.php:46
*
* @see DriverInterface::id()
*/
public function id(): string
{
return 'Imagick';
}
/**
* {@inheritdoc}
*
* @see DriverInterface::checkHealth()
*
* @codeCoverageIgnore
*/
public function checkHealth(): void
{
if (!extension_loaded('imagick') || !class_exists('Imagick')) {
throw new MissingDependencyException(
'Imagick PHP extension must be installed to use this driver',
);
}
}
/**
* {@inheritdoc}
*
* @see DriverInterface::createImage()
*
* @throws InvalidArgumentException
* @throws DriverException
*/
public function createImage(int $width, int $height): ImageInterface
{
if ($width < 1 || $height < 1) {
throw new InvalidArgumentException('Invalid image size. Must be int<1, max>');
}View on GitHub (pinned to 5598b9e397)
Solutions
- Install the extension: apt install php-imagick (Debian), apk add php83-imagick (Alpine), or pecl install imagick plus extension=imagick.so in the ini
- Verify with `php -m | grep imagick` and `php --ri imagick` (also shows the linked ImageMagick version)
- Confirm the ini file lives in the scanned directory shown by `php --ini` after rebuilding the container
- If the extension cannot be installed in that environment, construct the manager with the GD driver instead
Example fix
# before: Dockerfile without imagick
FROM php:8.3-fpm
# after
FROM php:8.3-fpm
RUN apt-get update && apt-get install -y libmagickwand-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick Defensive patterns
Strategy: validation
Validate before calling
if (!extension_loaded('imagick') || !class_exists('Imagick')) {
$manager = new \Intervention\Image\ImageManager(['driver' => 'gd']);
} else {
$manager = new \Intervention\Image\ImageManager(['driver' => 'imagick']);
} Type guard
function imagickDriverAvailable(): bool
{
return extension_loaded('imagick') && class_exists('Imagick');
} Try / catch
try {
$manager = new \Intervention\Image\ImageManager(['driver' => 'imagick']);
} catch (\Intervention\Image\Exceptions\MissingDependencyException $e) {
$manager = new \Intervention\Image\ImageManager(['driver' => 'gd']);
} Prevention
- Run `php -m | grep imagick` in your Docker build/CI to fail fast on missing extensions
- Bake ext-imagick plus delegate libraries into dedicated image variants
- Re-verify extensions after every PHP major upgrade (compiled extensions silently drop on API mismatch)
When it happens
Trigger: new ImageManager(['driver' => 'imagick']) or ImageManager::imagick() on a host without ext-imagick: bare PHP CLI, a container built without the PECL extension, or after a PHP upgrade left a version-mismatched extension silently unloaded.
Common situations: Production Docker image differs from dev; PHP major-version upgrade breaks the compiled extension (API mismatch -> not loaded); Alpine images missing php8X-imagick; CI matrix testing drivers the runner cannot support.
Related errors
- Class '{objectShortname}' is not supported by {id} driver
- GD PHP extension must be installed to use this driver
- Given color space must implement Intervention\Image\Interfac
- Failed to analyze unknown colorspace
- Failed to analyze colorspace
AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23).
Data as JSON: /api/errors/56374b178ad9a734.
Report an issue: GitHub.