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.
Installing ImageMagick
For Ubuntu/Debian
1 Update the Package List
sudo apt update
2 Install ImageMagick
sudo apt install imagemagick php-imagick -y
3 Restart the Web Server
For Apache:
sudo systemctl restart apache2
For Nginx with PHP-FPM:
sudo systemctl restart php7.x-fpm
4 Verify Installation
php -m | grep imagick
If installed, imagick will appear in the output.
For CentOS/RHEL
1 Enable the EPEL Repository
sudo yum install epel-release -y
2 Install ImageMagick
sudo yum install ImageMagick ImageMagick-devel php-pecl-imagick -y
3 Restart the Web Server
sudo systemctl restart httpd
or for PHP-FPM:
sudo systemctl restart php-fpm
4 Verify Installation
php -m | grep imagick
For Windows Servers
1 Download ImageMagick
Download the ImageMagick binary for Windows from the official ImageMagick website.
2 Install the binary
Install the binary and add its path to the system environment variables.
3 Enable the imagick extension in php.ini
extension=imagick
4 Restart the web server
Installing GD
For Ubuntu/Debian
1 Update the Package List
sudo apt update
2 Install the GD Library
sudo apt install php-gd -y
3 Restart the Web Server
For Apache:
sudo systemctl restart apache2
For Nginx with PHP-FPM:
sudo systemctl restart php7.x-fpm
4 Verify Installation
php -m | grep gd
If installed, gd will appear in the output.
For CentOS/RHEL
1 Install the GD Library
sudo yum install php-gd -y
2 Restart the Web Server
sudo systemctl restart httpd
or for PHP-FPM:
sudo systemctl restart php-fpm
3 Verify Installation
php -m | grep gd
For Windows Servers
1 Enable the gd extension in php.ini
extension=gd
2 Restart the web server
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
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:
- Verify the PHP extensions directory:
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.


