Install PHP’s GD extension using the method that matches your PHP installation: enable the bundled DLL on Windows, add the correct development libraries and configure switches when compiling PHP, or install the GD package supplied for your operating system. The exact steps depend on your PHP version, operating system and whether you are configuring the command-line interpreter or the PHP runtime used by your web server.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
GD is enabled at build or configuration time. Installing a library on the system is not enough unless the PHP binary you actually run was built with GD or is loading its GD extension.
As an Amazon Associate I earn from qualifying purchases.
Choose the installation path first
Before changing anything, determine how PHP was installed. The installation method decides where GD is enabled and which instructions apply.
| PHP installation | Where GD is enabled | What you need to do | Important qualification |
|---|---|---|---|
| Windows binary | The active php.ini file |
Enable the bundled GD DLL and restart the PHP-serving process | PHP 8.0 and later use php_gd.dll; earlier releases used php_gd2.dll |
| Source build on Unix-like systems | PHP’s configure and build options | Install GD development libraries, select the version-appropriate switches, then rebuild PHP | At minimum, compilation requires libpng and libjpeg; PNG support also requires zlib |
| Distribution package | The package manager’s PHP build and configuration | Install the GD package matching your PHP version, restart the relevant service, and verify the loaded runtime | Package names and restart commands differ by operating system and PHP version |
Do not mix the paths. A configure flag belongs to a source build; it will not enable GD in an already-installed Windows binary. Conversely, enabling a Windows DLL does not add GD to a PHP binary that was compiled without the extension.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
What PHP version changes
GD’s configure switches changed over time. Use the syntax documented for the PHP version you are compiling rather than copying an older tutorial unchanged.
| PHP release family | GD enablement | Format and font switch examples |
|---|---|---|
| Older releases | The manual documents --with-gd[=DIR] |
Older instructions may use --with-jpeg-dir, --with-webp-dir and --with-xpm-dir |
| PHP 7.4 and later | --enable-gd enables the extension; --with-external-gd selects an external libgd |
--with-jpeg, --with-webp, --with-xpm and --with-freetype |
| PHP 8.1 and later | Use the current GD enablement switches for the release | --with-avif is available from PHP 8.1.0; the other format switches still require their corresponding libraries |
The PHP 7.4 change is especially important: newer builds use --enable-gd to turn GD on, while --with-external-gd chooses an external libgd instead of the bundled library. A command copied from a pre-7.4 guide can therefore fail or select the wrong behavior.
Install GD on Windows
Windows PHP distributions include GD as a bundled extension. You normally do not compile libgd yourself; you enable the DLL that belongs to the PHP build you are running.
1. Find the configuration used by the running PHP
Locate the active php.ini for the PHP runtime that serves your application. A machine can contain several PHP installations, and the command-line interpreter, Apache module and PHP-FPM-like service can each load a different configuration. Edit the file reported by the runtime you intend to use, not merely the first php.ini you find on disk.
2. Enable the correct GD DLL
In that configuration, enable the bundled GD extension named php_gd.dll for PHP 8.0 and later. For PHP versions before 8.0, check for the legacy filename php_gd2.dll instead. Keep the filename consistent with the DLL present in the PHP installation and with the PHP version.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
3. Restart the PHP-serving process
Restart the process that loads PHP after saving php.ini. A web server that was already running will continue using its old module until it is restarted. If you test only from a terminal, you may still be checking a different PHP configuration from the one used by the website.
Free tools Windows power users keep installed
One-click scans. No signup required.
4. Verify the web runtime and CLI separately
Use the extension list or a temporary PHP information page appropriate to each runtime. Confirm that GD appears in the same environment that will execute the image code. If GD appears in the CLI but not in the site, inspect the web server’s PHP configuration and restart state; if it appears on the site but not in the CLI, inspect the CLI binary and its loaded php.ini.
Compile GD into PHP on a Unix-like system
A source build gives you control over the GD version and image capabilities, but every capability must be available when PHP is configured and compiled.
1. Install the development libraries
Provide the development packages for libpng and libjpeg before configuring PHP. The PHP Manual states that “GD library requires libpng and libjpeg to compile.” PNG support also requires zlib. These are development libraries, not merely image files or runtime-only packages.
If you need additional formats, install the matching development library before adding its switch:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
- WebP support uses
--with-webp. - AVIF support uses
--with-avifon PHP 8.1.0 and later. - XPM support uses
--with-xpm. - FreeType font support uses
--with-freetypeon PHP 7.4 and later and relies onpkg-configto locate the library.
2. Select bundled or external GD
For PHP 7.4 and later, enable GD with --enable-gd. Add --with-external-gd only when you intentionally want PHP to use an external libgd rather than its bundled library. Older PHP releases may require the documented --with-gd[=DIR] form.
3. Add only the switches your build needs
A minimal current-style configuration includes GD enablement plus the image formats your application must read or write. For example, a build that needs JPEG, WebP and FreeType would use the corresponding --with-jpeg, --with-webp and --with-freetype options in addition to --enable-gd. Do not add a switch until its library is installed and discoverable by the build system.
4. Keep libpng versions consistent
The PHP Manual warns that the libpng version used while compiling PHP must match the version linked with GD. A mismatch can produce a build that completes but does not behave reliably. Check that your compiler and linker are resolving the intended libpng installation rather than mixing system and custom library versions.
5. Build, install and restart the runtime
Run the normal configure, compile and installation sequence for your PHP source tree, then restart the web server or PHP process that loads the newly installed binary. The exact package commands and service names depend on your operating system and deployment, so do not substitute a command written for another distribution.
Install GD from a distribution package
Package-managed PHP is usually the least invasive route when your operating system supplies a matching GD package. The package name, repository and service restart command vary with the distribution, PHP release and whether PHP runs through a web server module or a separate process.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Use a matching package
- Record the PHP major and minor version used by the application.
- Identify the operating-system distribution and the PHP installation source.
- Choose that distribution’s GD package for the same PHP version. Do not install a package for a different PHP branch merely because its name contains “gd.”
- Allow the package manager to install its required libraries and configuration files.
- Restart the PHP-serving process specified by that distribution’s documentation.
- Verify GD in the runtime that serves the application, then check the CLI separately if command-line scripts also need it.
There is no distribution-neutral install command or restart command that is safe to publish for every system. Debian-family, Red Hat-family, Alpine and vendor-provided PHP builds use different package names and service layouts. If you need a command-specific recipe, first identify the distribution and PHP version.
Enable the image capabilities your application actually needs
GD itself can be enabled while a particular image format remains unavailable. Format support is a build-time choice, so treat each switch and its dependency as a separate requirement.
| Capability | Switch on current PHP versions | Version or dependency note |
|---|---|---|
| JPEG | --with-jpeg |
Use on PHP 7.4 and later; older releases may use --with-jpeg-dir |
| WebP | --with-webp |
Older releases may use --with-webp-dir |
| XPM | --with-xpm |
Older releases may use --with-xpm-dir |
| AVIF | --with-avif |
Available from PHP 8.1.0 |
| FreeType fonts | --with-freetype |
Available from PHP 7.4 onward and located through pkg-config |
PNG is part of the core GD dependency set rather than an optional switch listed above: libpng is required to compile GD, and zlib is required for PNG support. If a format is missing after installation, check both the build switch and the corresponding library.
Verify that the right PHP has GD
Verification must target the same PHP runtime that will execute your code. A successful CLI check does not prove that Apache, a web server module or a PHP process manager loaded the extension.
CLI check
Use the CLI interpreter’s configuration and extension-list tools to confirm that GD is loaded. First establish which PHP binary and php.ini the command line is using; then inspect its loaded extensions. If GD is absent, the CLI may point to another PHP installation, another version or another configuration file.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Web check
For a website, inspect the PHP information exposed by the web-serving runtime or use the application’s own diagnostics. Confirm the loaded configuration path and the GD entry there. Remove any temporary diagnostic page after testing, because it can disclose environment details.
Capability check
Seeing the GD extension name proves that the extension loaded, not that every format is available. Check the reported GD capabilities for JPEG, WebP, AVIF, XPM and FreeType when your application depends on them. A missing capability points back to the corresponding compile switch and library rather than to the extension-loading step.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallTroubleshoot the common failure modes
“GD is missing” in the application
Determine whether the failure occurs in the CLI, the web runtime or both. If only one environment fails, compare its PHP version, active configuration file and extension list with the working environment. Restart the process after changing configuration; otherwise it may still hold the previous extension set.
Windows reports that the GD DLL cannot be loaded
Check the filename against the PHP release: php_gd.dll is the current name, while pre-8.0 releases use php_gd2.dll. Confirm that the DLL belongs to the PHP installation being loaded, that the edited php.ini is the active one, and that the serving process was restarted.
The source build cannot find libpng or libjpeg
Install the development versions of both libraries, not only runtime libraries, and rerun configuration. PNG additionally needs zlib. If you have multiple library installations, verify that the compiler and linker resolve a consistent set.
A requested format is unavailable
GD can load successfully while a format remains disabled. Recheck the PHP-version syntax for the switch, install the matching development library, rebuild PHP and verify the capability in the runtime that serves the application. Do not use a legacy *-dir option on a release that expects the newer switch names.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →FreeType support does not configure
On PHP 7.4 and later, --with-freetype depends on pkg-config. Make sure that tool can locate the FreeType development files before rerunning configuration.
PNG behaves inconsistently after compilation
Check the libpng versions linked into the build and GD. The versions must match; mixed system and custom installations are a common source of an apparently successful but unreliable build.
Quick Recap
Installation checklist
- Identify the PHP version and whether PHP came from a Windows binary, a distribution package or a source build.
- Identify the runtime that needs GD: CLI, web server, PHP process manager or more than one.
- For Windows, enable the correct DLL in the active
php.iniand restart the serving process. - For source builds, install libpng and libjpeg development libraries; add zlib for PNG support.
- Use
--enable-gdand the other current switch names on PHP 7.4 and later; use the older forms only for older PHP releases. - Add WebP, AVIF, XPM or FreeType support only when the required library and PHP version support it.
- Keep the libpng version consistent with the one linked by GD.
- Verify the extension and individual capabilities in every PHP runtime that will run the application.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




