The Imagick PHP extension connects applications to ImageMagick's image-processing library. On Ubuntu, a package install needs a check in the PHP runtime serving your application to confirm it works.
Ubuntu maintains the php-imagick package, which installs the extension and its ImageMagick library dependencies. The separate imagemagick package supplies command-line tools such as magick; installing those tools alone does not make the Imagick class available to PHP.
The PHP command-line interpreter, Apache module, and PHP-FPM can load different extension configurations, even on the same server. A working PHP command-line installation is a prerequisite, and a web application must already have its PHP handler configured before its extension can be checked through a web request.
Steps to install the Imagick PHP extension on Ubuntu:
- Refresh the APT package index.
$ sudo apt-get update
- Install the Imagick extension from Ubuntu's repositories.
$ sudo apt-get install --yes php-imagick
The package follows Ubuntu's default PHP branch, PHP 8.5 on Ubuntu 26.04 LTS, and enables the extension itself. A site on another PHP branch needs that branch's versioned package, such as php8.3-imagick, from the repositories that supply it, and a runtime with the extension turned off needs sudo phpenmod imagick. If APT cannot locate the package, the universe component must be enabled in the Ubuntu package sources.
- Confirm that the current PHP command-line runtime loads Imagick.
$ php --ri imagick imagick imagick module => enabled imagick module version => 3.8.0 ##### snipped #####
Extension 'imagick' not present. means this interpreter has not loaded the extension. Versions and supported formats vary by Ubuntu release and enabled repositories. A command-line application needs nothing more; the remaining steps apply to a website.
- Reload the service that runs PHP for the website.
$ sudo systemctl reload php8.5-fpm
The service name follows the site's PHP version, such as php8.3-fpm for PHP 8.3. A site using the Apache PHP module reloads Apache instead with sudo systemctl reload apache2.
Related: Manage the PHP-FPM service - Create a temporary file named info.php in the site's document root using your text editor.
A phpinfo() page shows server details to anyone who can reach it, so delete it as soon as the check is done.
$ sudoedit /var/www/html/info.php
/var/www/html is the default document root; a site with its own document root needs that path here and in the last step.
- Open http://example.com/info.php in a browser to view the imagick section.
example.com stands for your own site's address. The section's imagick module row shows enabled. If the section is missing, the Server API row near the top of the page shows which service to reload: FPM/FastCGI means the site's PHP-FPM service, and Apache 2 Handler means apache2. PHP source text or a download means the site has no working PHP handler.
- Delete the temporary info.php file.
$ sudo rm /var/www/html/info.php