php extension ai_generated true

Fatal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in /var/www/app/src/Image/Processor.php:28

ID: php/gd-extension-missing

Also available as: JSON · Markdown
95%Fix Rate
96%Confidence
60Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
83 active

Root Cause

GD extension missing errors occur when PHP's GD image processing extension is not installed or not enabled. This is common in minimal Docker images and fresh server installations where PHP extensions must be explicitly installed.

generic

Workarounds

  1. 95% success Install the php-gd extension with all required system libraries
    On Debian/Ubuntu: apt-get install php8.3-gd. On Alpine (Docker): apk add libpng-dev libjpeg-turbo-dev freetype-dev && docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install gd. Restart PHP-FPM after installation.
  2. 88% success Use Imagick extension as an alternative to GD for advanced image processing
    Install: apt-get install php8.3-imagick (or pecl install imagick for Docker). Imagick provides more features than GD including support for over 200 image formats, better quality resizing, and SVG support.

Dead Ends

Common approaches that don't work:

  1. Installing only php-gd without the required system libraries 65% fail

    The GD extension depends on system libraries like libjpeg, libpng, libwebp, and libfreetype. Without them, GD installs but cannot process those image formats, causing runtime errors on specific image operations.

  2. Using a polyfill library to emulate GD functions without the extension 75% fail

    GD polyfills are extremely slow and incomplete. They cannot match the performance or feature set of the native C extension, and many image operations will fail or produce incorrect results.

Error Chain

Leads to:
Preceded by:
Frequently confused with: