Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why did gd configure failed? error: unrecognized options: --with-gd, --with-png

I created my own Dockerfile for the Php code I need to deploy. Due to space limitation,I show only the beginning of it

FROM php:7.4-fpm

WORKDIR /var/www
RUN apt-get update && apt-get install -y \
    build-essential \
    libpng-dev \
    libonig-dev \
    libjpeg62-turbo-dev \
    libfreetype6-dev \
    locales \
    zip \
    jpegoptim optipng pngquant gifsicle \
    vim \
    unzip \
    git \
    curl \
    libzip-dev
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-png=/usr/include/
RUN docker-php-ext-install gd

I got error

Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
configure: error: unrecognized options: --with-gd, --with-png
The command '/bin/sh -c docker-php-ext-configure gd --with-gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-png=/usr/include/' returned a non-zero code: 1

what should I change?

like image 234
Richard Rublev Avatar asked Oct 18 '25 12:10

Richard Rublev


1 Answers

As of PHP 7.4.0, --with-gd becomes --enable-gd

https://www.php.net/manual/en/image.installation.php

It's not obligatory, example:

RUN apt-get --yes install libfreetype6-dev \
                          libjpeg62-turbo-dev \
                          libpng-dev \
                          libwebp-dev 

RUN set -e; \
    docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype; \
    docker-php-ext-install -j$(nproc) gd
like image 59
cetver Avatar answered Oct 21 '25 01:10

cetver



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!