To determine if ImageMagick or GD is installed and enabled on your server, follow these steps.
Using PHP Script
Create a File
Name it something like check-imagemagick-gd.php and add the following code:
echo "Checking PHP extensions...<br>";
// Check for GD
if (extension_loaded('gd')) {
echo "GD is installed and enabled.<br>";
} else {
echo "GD is not installed.<br>";
}
// Check for ImageMagick
if (extension_loaded('imagick')) {
echo "ImageMagick is installed and enabled.<br>";
} else {
echo "ImageMagick is not installed.<br>";
}
phpinfo();
?>
Upload the File
Upload it to your server (e.g., via FTP or cPanel File Manager) in the web-accessible directory.
Run the Script
Access it in your browser:
The script will display whether GD and/or ImageMagick are installed and enabled.
Remove the Script After Testing
For security reasons, delete the check-imagemagick-gd.php file once you are done.
Using Command Line
Check GD Module:
Run the following command to see if GD is installed:
If gd appears in the output, it is installed.
Check ImageMagick Module:
Run the following command to check for ImageMagick:
If imagick appears in the output, it is installed.
Check via phpinfo()
- Create a new PHP file named phpinfo.php with the following code:
- Access the file in your browser:
- Look for:
- gd section: Check if GD is enabled and displays details like GD Version.
- imagick section: Check if ImageMagick is listed with its version.
- Remove the phpinfo.php file after testing.
phpinfo();
?>
Check the Installed Packages (Linux Servers)
For ImageMagick:
Run:
If installed, it will display the ImageMagick version.
For GD:
GD is included in the PHP package. To confirm:
Next Steps
If GD or ImageMagick is not installed, you will need to install and enable them. Here are the installation commands for Ubuntu/Debian:
Install GD:
sudo apt install php-gd
sudo systemctl restart apache2
Install ImageMagick:
sudo apt install imagemagick php-imagick
sudo systemctl restart apache2
After installation, rerun the checks to verify that the extensions are now enabled.


