Install ImageMagick or GD — Server Administrator's Guide
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.
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
sudo apt update
sudo apt install imagemagick php-imagick -y
For Apache:
sudo systemctl restart apache2
For Nginx with PHP-FPM:
sudo systemctl restart php7.x-fpm
php -m | grep imagick
If installed, imagick will appear in the output.
For CentOS/RHEL
sudo yum install epel-release -y
sudo yum install ImageMagick ImageMagick-devel php-pecl-imagick -y
sudo systemctl restart httpd
or for PHP-FPM:
sudo systemctl restart php-fpm
php -m | grep imagick
For Windows Servers
Download the ImageMagick binary for Windows from the official ImageMagick website.
Install the binary and add its path to the system environment variables.
extension=imagick
Installing GD
For Ubuntu/Debian
sudo apt update
sudo apt install php-gd -y
For Apache:
sudo systemctl restart apache2
For Nginx with PHP-FPM:
sudo systemctl restart php7.x-fpm
php -m | grep gd
If installed, gd will appear in the output.
For CentOS/RHEL
sudo yum install php-gd -y
sudo systemctl restart httpd
or for PHP-FPM:
sudo systemctl restart php-fpm
php -m | grep gd
For Windows Servers
extension=gd
Enable Extensions in PHP
Ensure that the imagick and gd extensions are enabled in php.ini:
- Locate the php.ini file:
- Open the file in a text editor:
- Uncomment (or add) the lines:
- Save and exit, then restart your web server.
php --ini
sudo nano /etc/php/7.x/apache2/php.ini # For Apache
sudo nano /etc/php/7.x/fpm/php.ini # For PHP-FPM
extension=gd
extension=imagick
Verify in WordPress
- Go to your WordPress Admin Dashboard.
- Navigate to Media > Add New.
- Upload an image and test resizing functionality.
Troubleshooting
GD or ImageMagick Not Detected
- Ensure the correct PHP version is used:
php -v
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.


