To determine if ImageMagick or GD is installed and enabled on your server, follow these steps.

Using PHP Script

1

Create a File

Name it something like check-imagemagick-gd.php and add the following code:

<?php
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();
?>
2

Upload the File

Upload it to your server (e.g., via FTP or cPanel File Manager) in the web-accessible directory.

3

Run the Script

Access it in your browser:

http://yourdomain.com/check-imagemagick-gd.php

The script will display whether GD and/or ImageMagick are installed and enabled.

4

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:

php -m | grep gd

If gd appears in the output, it is installed.

Check ImageMagick Module:

Run the following command to check for ImageMagick:

php -m | grep imagick

If imagick appears in the output, it is installed.

Check via phpinfo()

  1. Create a new PHP file named phpinfo.php with the following code:
  2. <?php
    phpinfo();
    ?>
  3. Access the file in your browser:
  4. http://yourdomain.com/phpinfo.php
  5. 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.
  6. Remove the phpinfo.php file after testing.

Check the Installed Packages (Linux Servers)

For ImageMagick:

Run:

convert --version

If installed, it will display the ImageMagick version.

For GD:

GD is included in the PHP package. To confirm:

php -i | grep -i gd

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 update
sudo apt install php-gd
sudo systemctl restart apache2

Install ImageMagick:

sudo apt update
sudo apt install imagemagick php-imagick
sudo systemctl restart apache2

After installation, rerun the checks to verify that the extensions are now enabled.