# Error building php build

**URL:** <https://forums.docker.com/t/error-building-php-build/115217>\
**Category:** Docker Hub\
**Tags:** dockerhub, build\
**Created:** [September 15, 2021, 6:57am UTC](https://forums.docker.com/t/error-building-php-build/115217 "2021-09-15T06:57:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eeromay](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@eeromay](https://forums.docker.com/u/eeromay)\
**Post date:** [September 15, 2021, 6:57am UTC](https://forums.docker.com/t/error-building-php-build/115217/1 "2021-09-15T06:57:31Z")

</div>

Hi.

We had some php builds in our private repository.  
A few weeks ago the builds were successful, but now the builds fails with:

```auto
#9 ERROR: executor failed running [/bin/sh -c NPROC=$(getconf _NPROCESSORS_ONLN) && docker-php-ext-install -j${NPROC} iconv intl opcache pcntl pdo pdo_mysql pdo_sqlite readline session simplexml xml xsl zip gd && pecl install xdebug && docker-php-ext-enable xdebug && pecl install apcu && docker-php-ext-enable apcu && apk del .gd-build-deps && apk del .build-deps && apk del .ext-build-deps && rm -r /tmp/*]: exit code: 2
------
> [5/21] RUN NPROC=$(getconf _NPROCESSORS_ONLN) && docker-php-ext-install -j${NPROC} iconv intl opcache pcntl pdo pdo_mysql pdo_sqlite readline session simplexml xml xsl zip gd && pecl install xdebug && docker-php-ext-enable xdebug && pecl install apcu && docker-php-ext-enable apcu && apk del .gd-build-deps && apk del .build-deps && apk del .ext-build-deps && rm -r /tmp/*:
------
error: failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c NPROC=$(getconf _NPROCESSORS_ONLN) && docker-php-ext-install -j${NPROC} iconv intl opcache pcntl pdo pdo_mysql pdo_sqlite readline session simplexml xml xsl zip gd && pecl install xdebug && docker-php-ext-enable xdebug && pecl install apcu && docker-php-ext-enable apcu && apk del .gd-build-deps && apk del .build-deps && apk del .ext-build-deps && rm -r /tmp/*]: exit code: 2
Build failed using Buildkit

```

The Dockerfile we use:

```auto
FROM php:8.0-fpm-alpine

# Install PHP extensions
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \
    apk add --no-cache --virtual .gd-runtime-deps freetype libpng libjpeg-turbo && \
    apk add --no-cache --virtual .gd-build-deps freetype-dev libpng-dev libjpeg-turbo-dev && \
    apk add --no-cache --virtual .ext-runtime-deps libbz2 libzip-dev libmcrypt libxslt icu && \
    apk add --no-cache --virtual .ext-build-deps bzip2-dev libmcrypt-dev libxml2-dev libedit-dev libxslt-dev icu-dev sqlite-dev

RUN docker-php-ext-configure gd \
      --with-freetype=/usr/include/ \
      --with-jpeg=/usr/include/

RUN NPROC=$(getconf _NPROCESSORS_ONLN) && \
    docker-php-ext-install -j${NPROC} bz2 dom exif fileinfo

RUN NPROC=$(getconf _NPROCESSORS_ONLN) && \
    docker-php-ext-install -j${NPROC} iconv intl opcache pcntl pdo pdo_mysql pdo_sqlite readline session simplexml xml xsl zip gd && \
    pecl install xdebug && \
    docker-php-ext-enable xdebug && \
    pecl install apcu && \
    docker-php-ext-enable apcu && \
    apk del .gd-build-deps && \
    apk del .build-deps && \
    apk del .ext-build-deps && \
    rm -r /tmp/*

# download composerin the latest stable release
RUN curl -o composer-installer.php https://getcomposer.org/installer && \
    php composer-installer.php --quiet --install-dir="/usr/local/bin" && \
    ln -s /usr/local/bin/composer.phar /usr/local/bin/composer && \
    rm composer-installer.php

# Install git+ssh (for composer install)
RUN apk add --no-cache git openssh-client rsync

# Install mysql client (for data-transfer operations)
RUN apk add --no-cache mysql-client

# Install timezone change utils
RUN apk add --no-cache tzdata

# Tools to change the uid on run
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories && \
    apk add --no-cache shadow su-exec

# Install and configure fcron
RUN groupadd -r -g 109 fcron && \
    useradd -u 109 -r fcron -g fcron && \
    apk add --no-cache --virtual .build-deps g++ make perl && \
    wget http://fcron.free.fr/archives/fcron-3.3.0.src.tar.gz && \
    tar xfz fcron-3.3.0.src.tar.gz && \
    cd fcron-3.3.0 && \
    ./configure && \
    make && \
    make install && \
    apk del .build-deps && \
    rm -Rf fcron-3.3.0*z
ADD fcron.conf /usr/local/etc
ADD echomail /usr/local/bin
RUN chown root:fcron /usr/local/etc/fcron.conf && \
    chmod 644 /usr/local/etc/fcron.conf

# Default configuration for fpm
# Project-specific ini can be added with COPY ./php-ini-overrides.ini /usr/local/etc/php/conf.d/
COPY ./zz-fpm.conf /usr/local/etc/php-fpm.d/

# Base php ini
COPY ./docker-base.ini /usr/local/etc/php/conf.d/

# Disable xdebug by default and add a script to reactivate
# Just add a COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini.bak in your project
COPY xdebug.sh /
RUN mv /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini.bak

# Cache composer downloads in a volume
VOLUME /var/www/.composer

# Script to wait for db
COPY wait-for /usr/local/bin

COPY entrypoint-cron /usr/local/bin
COPY entrypoint-chuid /usr/local/bin
ENTRYPOINT ["entrypoint-chuid"]
CMD ["php-fpm"]

```

Locally it builds without errors, but on dockerhub we get this error since a few weeks.

Anyone knows why this happens?

Kind regards.

---

<div class="post-metadata">

**Author:** ![ayushsahu](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ayushsahu/32/32793_2.png) [@ayushsahu](https://forums.docker.com/u/ayushsahu)\
**Post date:** [February 21, 2022, 4:17pm UTC](https://forums.docker.com/t/error-building-php-build/115217/2 "2022-02-21T16:17:38Z")

</div>

I am also facing same issue while using docker-php-ext-install readline in FROM php:8.1.3-apache

Error:  
cc -I. -I/usr/src/php/ext/readline -I/usr/src/php/ext/readline/include -I/usr/src/php/ext/readline/main -I/usr/src/php/ext/readline -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/editline -fstack-protector-strong -fpic -fpie -O2 -D\_LARGEFILE\_SOURCE -D\_FILE\_OFFSET\_BITS=64 -DHAVE\_CONFIG\_H -fstack-protector-strong -fpic -fpie -O2 -D\_LARGEFILE\_SOURCE -D\_FILE\_OFFSET\_BITS=64 -Wno-strict-prototypes -DZEND\_COMPILE\_DL\_EXT=1 -c /usr/src/php/ext/readline/readline.c -MMD -MF readline.dep -MT readline.lo -fPIC -DPIC -o .libs/readline.o  
In file included from /usr/local/include/php/main/php.h:35,  
from /usr/src/php/ext/readline/readline.c:23:  
/usr/src/php/ext/readline/readline.c: In function ‘zif\_readline\_info’:  
/usr/src/php/ext/readline/readline.c:160:38: error: ‘rl\_mark’ undeclared (first use in this function)  
160 | add\_assoc\_long(return\_value,“mark”,rl\_mark);  
| ^ ~~~~~~  
/usr/local/include/php/Zend/zend\_API.h:509:90: note: in definition of macro ‘add\_assoc\_long’  
509 | #define add\_assoc\_long(\_\_arg, \_\_key, \_\_n) add\_assoc\_long\_ex(\_\_arg, \_\_key, strlen(\_\_key), \_\_n)  
| ^~~  
/usr/src/php/ext/readline/readline.c:160:38: note: each undeclared identifier is reported only once for each function it appears in  
160 | add\_assoc\_long(return\_value,“mark”,rl\_mark);  
| ^ ~~~~~~  
/usr/local/include/php/Zend/zend\_API.h:509:90: note: in definition of macro ‘add\_assoc\_long’  
509 | #define add\_assoc\_long(\_\_arg, \_\_key, \_\_n) add\_assoc\_long\_ex(\_\_arg, \_\_key, strlen(\_\_key), \_\_n)  
| ^~~  
/usr/src/php/ext/readline/readline.c:162:47: error: ‘rl\_pending\_input’ undeclared (first use in this function)  
162 | add\_assoc\_long(return\_value,“pending\_input”,rl\_pending\_input);  
| ^ ~~~~~~~~~~~~~~~  
/usr/local/include/php/Zend/zend\_API.h:509:90: note: in definition of macro ‘add\_assoc\_long’  
509 | #define add\_assoc\_long(\_\_arg, \_\_key, \_\_n) add\_assoc\_long\_ex(\_\_arg, \_\_key, strlen(\_\_key), \_\_n)  
| ^~~  
/usr/src/php/ext/readline/readline.c:169:60: error: ‘rl\_completion\_suppress\_append’ undeclared (first use in this function)  
169 | add\_assoc\_bool(return\_value,“completion\_suppress\_append”,rl\_completion\_suppress\_append);  
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
/usr/local/include/php/Zend/zend\_API.h:511:90: note: in definition of macro ‘add\_assoc\_bool’  
511 | #define add\_assoc\_bool(\_\_arg, \_\_key, \_\_b) add\_assoc\_bool\_ex(\_\_arg, \_\_key, strlen(\_\_key), \_\_b)  
| ^~~  
make: \*\*\* [Makefile:202: readline.lo] Error 1  
The command ‘/bin/sh -c docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-freetype=/usr/include/ && apt-get install libonig-dev && docker-php-ext-install mbstring exif xml dom mysqli curl calendar bz2 gettext shmop sockets opcache zip readline’ returned a non-zero code: 2  
ERROR: Service ‘app’ failed to build : Build failed
