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

Time:04-26

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?

CodePudding user response:

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
  • Related