How7oHow7o
  • Home
  • Tools
    • All Tools
    • Image Tools
    • Text & String Tools
    • Video Tools
    • Developer Tools
    • PDF Tools
    • Calculators & More
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: How to Check if GD Library Is Installed in PHP (3 Easy Methods)
Share
Notification Show More
Font ResizerAa
How7oHow7o
Font ResizerAa
  • OS
Search
  • Home
  • Tools
    • All Tools
    • Image Tools
    • Text & String Tools
    • Video Tools
    • Developer Tools
    • PDF Tools
    • Calculators & More
  • Prank Screens
  • Learn
  • Blog
  • Contact
Follow US
© 2024–2026 How7o. All rights reserved.
How7o > Free Laravel, PHP, WordPress & Server Tutorials > Web Development > How to Check if GD Library Is Installed in PHP (3 Easy Methods)
Web Development

How to Check if GD Library Is Installed in PHP (3 Easy Methods)

how7o
By how7o
Last updated: January 12, 2026
5 Min Read
Check if GD library is installed in PHP (phpinfo and extension_loaded)
SHARE

I ran into this when I was working on a PHP project that generates thumbnails. Everything looked fine… until I hit an image function and got errors like “Call to undefined function imagecreatefromjpeg()” or the script simply failed when trying to resize images.

Contents
  • What is the GD library in PHP?
  • Method 1: Check GD using phpinfo() (web browser method)
  • Method 2: Check GD using extension_loaded(‘gd’) (quick PHP script)
  • Method 3: Check GD from the command line (fastest on servers)
    • Important: CLI PHP vs Web Server PHP can be different
  • Extra check: Verify GD functions exist
  • If GD is NOT installed: how to install it
    • Ubuntu / Debian
    • AlmaLinux / Rocky / CentOS (RHEL-based)
    • Restart PHP / Web Server
  • FAQ
    • Is GD required for WordPress?
    • GD is installed but my site still says it’s missing
  • Final thoughts

That’s when I remembered: those image functions depend on the GD library. Some servers have it enabled by default, but many don’t—especially fresh VPS setups.

So here’s the exact way I check if GD library is installed in PHP, plus what to do if it’s missing.

What is the GD library in PHP?

GD is a PHP extension used for basic image processing—creating images, resizing, cropping, adding text, and working with JPG/PNG/GIF/WebP (depending on how it was compiled). If your project (or WordPress plugin/theme) needs to manipulate images, GD is one of the most common requirements.

Ways to check PHP GD extension: phpinfo, extension_loaded, php -m

Method 1: Check GD using phpinfo() (web browser method)

This is the easiest method if your PHP is running through a web server (Apache/Nginx). Create a file like phpinfo.php inside your web root:

<?php
phpinfo();

Open it in your browser:

https://yourdomain.com/phpinfo.php

Now press CTRL + F and search for gd. If GD is installed, you’ll usually see a section like gd or GD Support enabled.

Security tip: Delete phpinfo.php after checking. It reveals a lot of server information and you don’t want it public.

Method 2: Check GD using extension_loaded(‘gd’) (quick PHP script)

If you want a clean true/false result, this is my favorite. Create a file named gd-check.php:

<?php
if (extension_loaded('gd')) {
    echo "GD is installed and enabled ✅";
} else {
    echo "GD is NOT installed ❌";
}

Open it in the browser, or run it from CLI if you want:

php gd-check.php

Method 3: Check GD from the command line (fastest on servers)

If you have SSH access, you can check loaded PHP modules instantly:

php -m | grep -i gd

If GD is installed, you’ll see something like:

gd

If nothing shows, either GD isn’t installed, or you’re checking the wrong PHP version.

Important: CLI PHP vs Web Server PHP can be different

This one catches a lot of people (including me the first time). Your terminal might be using PHP 8.3, while your website is running PHP 8.1 via PHP-FPM. So always confirm the version:

php -v

If you have multiple versions installed, try:

php8.1 -m | grep -i gd
php8.2 -m | grep -i gd

Extra check: Verify GD functions exist

If you’re debugging a specific error, you can check if a GD function is available:

<?php
echo function_exists('imagecreatetruecolor')
    ? "GD functions available ✅"
    : "GD functions missing ❌";

If GD is NOT installed: how to install it

If your check shows GD is missing, install the GD package for your OS and PHP version.

Ubuntu / Debian

sudo apt update
sudo apt install -y php-gd

If you’re using a specific PHP version (example: 8.1):

sudo apt install -y php8.1-gd

AlmaLinux / Rocky / CentOS (RHEL-based)

sudo dnf install -y php-gd

Restart PHP / Web Server

After installing, restart the service your site uses:

  • Apache: sudo systemctl restart apache2 (or httpd on RHEL-based)
  • PHP-FPM: sudo systemctl restart php-fpm (or php8.1-fpm, php8.2-fpm, etc.)
  • Nginx (if using PHP-FPM): sudo systemctl restart nginx

Then run the same checks again (phpinfo() / extension_loaded('gd') / php -m) to confirm it’s enabled.

FAQ

Is GD required for WordPress?

WordPress can use GD or Imagick for image processing. Many hosting environments rely on GD by default, and some plugins specifically require it.

GD is installed but my site still says it’s missing

This usually means your CLI PHP has GD, but your web server PHP-FPM version doesn’t (or vice versa). Check PHP versions on both sides and install the correct phpX.Y-gd package.

Final thoughts

If you just want a fast answer, here’s the order I use:

  • Quickest: php -m | grep -i gd
  • Most reliable in PHP: extension_loaded('gd')
  • Most visual: phpinfo() (then search for “gd”)

Once GD is installed and enabled, image functions stop failing and projects that generate thumbnails start working immediately.

TAGGED:almalinuxApacheextension_loadedGD LibraryImage ProcessingNginxphpPHP ExtensionsPHP-FPMphpinfoUbuntu

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article Laravel Blade Time Format (HH:MM) How to Show Only Hours and Minutes in Laravel Blade (HH:MM)
Next Article Update Ubuntu to the latest kernel version Update Ubuntu to the Latest Kernel Version (Safe Server Steps)
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

You Might Also Like

Laravel database transactions explained
Web Development

Laravel Database Transactions Explained (DB::transaction vs beginTransaction)

6 Min Read
MySQL 8 create user and grant privileges on Ubuntu
Web Development

How to Create Users and Grant Privileges in MySQL 8 on Ubuntu

8 Min Read
Migrating files from cPanel to aaPanel using rsync
Server Management

cPanel to aaPanel Migration with rsync: Fix Permissions, SSH Port, and CSF Firewall

6 Min Read
WordPress cron job without a plugin — cron_schedules, wp_schedule_event, and action callback
Web Development

How to Schedule a Cron Job in WordPress Without a Plugin

7 Min Read
How7oHow7o

Free browser-based tools, prank screens, and step-by-step tech tutorials. No signup, nothing uploaded.

  • Private by design — your files never leave your device
  • Instant — no signup, no install, no waiting
  • Always free — no trials, no watermarks, no paywalls

Tools

  • PDF Editor
  • Image Upscaler
  • JPEG Compressor
  • Password Generator
  • QR Code Generator
  • Video Trimmer
  • See all tools →

Pranks

  • Cracked Screen Prank
  • Fake Blue Screen (BSOD)
  • Fake Disk Format
  • Fake Low Battery
  • Fake Virus Scan
  • Fake Windows 10 Update
  • See all prank screens →

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service
  • Sitemap
© 2024–2026 How7o. All rights reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?