Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Install ImageMagick or GD — Server Administrator's Guide

3 min read
20.08.2025

If your server does not have ImageMagick or GD installed or enabled, follow these steps based on your operating system to install and configure them.

Install ImageMagick GD Server
ImageMagick/GD — install system pkg + PHP extension + enable + restart.

For the check-it-first companion and related PHP-extension topics, see Server Does Not Have ImageMagick or GD Installed — How to Check, OpenCart mcrypt Extension, and vqmod::bootup — PHP domdocument Extension.

Installing ImageMagick

For Ubuntu/Debian

Update the Package List
sudo apt update
Install ImageMagick
sudo apt install imagemagick php-imagick -y
Restart the Web Server

For Apache:

sudo systemctl restart apache2

For Nginx with PHP-FPM:

sudo systemctl restart php7.x-fpm
Verify Installation
php -m | grep imagick

If installed, imagick will appear in the output.

For CentOS/RHEL

Enable the EPEL Repository
sudo yum install epel-release -y
Install ImageMagick
sudo yum install ImageMagick ImageMagick-devel php-pecl-imagick -y
Restart the Web Server
sudo systemctl restart httpd

or for PHP-FPM:

sudo systemctl restart php-fpm
Verify Installation
php -m | grep imagick

For Windows Servers

Download ImageMagick

Download the ImageMagick binary for Windows from the official ImageMagick website.

Install the binary

Install the binary and add its path to the system environment variables.

Enable the imagick extension in php.ini
extension=imagick
Restart the web server

Installing GD

For Ubuntu/Debian

Update the Package List
sudo apt update
Install the GD Library
sudo apt install php-gd -y
Restart the Web Server

For Apache:

sudo systemctl restart apache2

For Nginx with PHP-FPM:

sudo systemctl restart php7.x-fpm
Verify Installation
php -m | grep gd

If installed, gd will appear in the output.

For CentOS/RHEL

Install the GD Library
sudo yum install php-gd -y
Restart the Web Server
sudo systemctl restart httpd

or for PHP-FPM:

sudo systemctl restart php-fpm
Verify Installation
php -m | grep gd

For Windows Servers

Enable the gd extension in php.ini
extension=gd
Restart the web server
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Enable Extensions in PHP

Ensure that the imagick and gd extensions are enabled in php.ini:

  1. Locate the php.ini file:
  2. php --ini
  3. Open the file in a text editor:
  4. sudo nano /etc/php/7.x/apache2/php.ini  # For Apache
    sudo nano /etc/php/7.x/fpm/php.ini      # For PHP-FPM
  5. Uncomment (or add) the lines:
  6. extension=gd
    extension=imagick
  7. Save and exit, then restart your web server.

Verify in WordPress

  1. Go to your WordPress Admin Dashboard.
  2. Navigate to Media > Add New.
  3. Upload an image and test resizing functionality.

Troubleshooting

GD or ImageMagick Not Detected

  • Ensure the correct PHP version is used:
  • php -v
  • Verify the PHP extensions directory:
  • php -i | grep extension_dir

Web Server Not Restarting

Check error logs for issues:

sudo tail -f /var/log/apache2/error.log  # For Apache
sudo tail -f /var/log/nginx/error.log    # For Nginx

Additional Notes

  • ImageMagick is preferred for advanced image processing.
  • GD is recommended if you need a lightweight solution.
Frequently asked questions
Wrong SAPI's php.ini. Installing via apt enables in CLI php.ini; web SAPI (FPM, mod_php) reads its own. Find via `php -i | grep -i imagick` vs `php-fpm -i | grep -i imagick`. Add `extension=imagick` to FPM's php.ini and restart php-fpm. Apache mod_php: restart apache.
WP works with ImageMagick 6.x and 7.x via the imagick PHP extension. Common compatibility issue: distro ships ImageMagick 6.9 and policy.xml restricts certain operations (PDF, EPS for security). WP image processing may fail silently. Check `/etc/ImageMagick-6/policy.xml` — comment out restrictive `` lines for needed formats.
Both. They're separate extensions; WordPress prefers imagick if available, falls back to GD. Sites doing heavy image processing benefit from imagick (more formats, better quality). GD is built-in to many PHP packages and always available as a fallback. No conflict — enable both.
Contact host. Most cPanel/DirectAdmin shared providers have ImageMagick as a per-account PHP toggle in "Select PHP Version" → Extensions. If the toggle isn't there, file a ticket asking them to install ImageMagick server-wide. Some providers refuse, citing security; consider switching to a more capable host for image-heavy sites.
Related articles
Install ZIP Extension for OpenCart Based on OS & PHP Version
WordPress: Server Doesn't Have ImageMagick or GD Installed/Enabled
How a System Administrator Solves the _globalsign-domain-verification Issue