docker-php-extension-installer icon indicating copy to clipboard operation
docker-php-extension-installer copied to clipboard

Unable to install extensions on PHP 8.1

Open MichaelMackus opened this issue 2 years ago • 10 comments

Version of install-php-extensions

v.1.5.37

Error description

The command install-php-extensions gd intl pdo_mysql opcache zip is not working in a php:8.1-fpm docker container. I checked and each of these extensions appears to be supported for building in PHP 8.1 so I'm not sure the issue.

I get the following output after trying to install the extensions:

failed to solve: executor failed running [/bin/sh -c install-php-extensions gd intl pdo_mysql opcache zip]: exit code: 1

Along with a bunch of messages like this:

#0 111.9 [0/1] Re-running CMake...
#0 111.9 --- aom_configure: Detected CPU: x86_64
#0 112.4 -- Configuring done
#0 112.5 -- Generating done
#0 112.5 -- Build files have been written to: /tmp/src/tmp.vsLIEPDPzl/my.build
#0 112.5 [0/1] Re-running CMake...
#0 112.5 --- aom_configure: Detected CPU: x86_64
#0 113.0 -- Configuring done
#0 113.1 -- Generating done
#0 113.1 -- Build files have been written to: /tmp/src/tmp.vsLIEPDPzl/my.build
#0 113.1 [0/1] Re-running CMake...
#0 113.1 --- aom_configure: Detected CPU: x86_64
#0 113.6 -- Configuring done
#0 113.7 -- Generating done
#0 113.7 -- Build files have been written to: /tmp/src/tmp.vsLIEPDPzl/my.build
#0 113.7 [0/1] Re-running CMake...
#0 113.7 --- aom_configure: Detected CPU: x86_64
#0 114.2 -- Configuring done
#0 114.3 -- Generating done
#0 114.3 -- Build files have been written to: /tmp/src/tmp.vsLIEPDPzl/my.build
#0 114.3 [0/1] Re-running CMake...
#0 114.3 --- aom_configure: Detected CPU: x86_64
#0 114.8 -- Configuring done
#0 114.8 -- Generating done
#0 114.9 -- Build files have been written to: /tmp/src/tmp.vsLIEPDPzl/my.build
#0 114.9 [0/1] Re-running CMake...
#0 114.9 --- aom_configure: Detected CPU: x86_64
#0 115.4 -- Configuring done
#0 115.4 -- Generating done
#0 115.5 -- Build files have been written to: /tmp/src/tmp.vsLIEPDPzl/my.build

Docker image

php:8.1-fpm - same result on php:8.1-cli

Minimal Dockerfile

FROM  php:8.1-fpm

COPY --from=mlocati/php-extension-installer:latest /usr/bin/install-php-extensions /usr/bin/

RUN apt update && apt install git unzip -yq && \
    apt-get clean autoclean; apt-get autoremove --yes; rm -rf /var/lib/{apt,dpkg,cache,log}/

RUN install-php-extensions gd intl pdo_mysql opcache zip

MichaelMackus avatar Aug 12 '22 00:08 MichaelMackus

I'm getting the same error but different output.

failed to solve: executor failed running [/bin/sh -c install-php-extensions @composer pdo_pgsql pgsql igbinary redis xdebug]: exit code: 1

In my case I'm getting connection timeout trying to connect to https://pecl.php.net. Maybe temporary pecl server issue. Re-running failed on a different extension, so pecl seems to be finicky right now. I've had this working for quite awhile and just ran into this for the first time right now...

Maybe unrelated since your output messages are different but thought I'd mention.

Edit: seems down

Screenshot from 2022-08-11 19-36-14

kdevan avatar Aug 12 '22 02:08 kdevan

Same here. Fails at imagick install due to pecl.php.net being down.

StrangePeanut avatar Aug 12 '22 04:08 StrangePeanut

Aaaaand pecl is back. If you're still running into this issue then it's a separate issue and i'm sorry for derailing.

kdevan avatar Aug 12 '22 09:08 kdevan

[0/1] Re-running CMake...

This issue has been already reported multiple times, but since I can't replicate it, I can't fix it.

See also https://github.com/mlocati/docker-php-extension-installer/issues/614#issuecomment-1202846906.

mlocati avatar Aug 12 '22 15:08 mlocati

Can confirm everything works fine since pecl.php.net is back up. As this is a common issue that pops up every so often, perhaps a solution would be to download from mirrors if there are any?

Edit: and it's down again 21:50 UK........ terrible host. Unfortunately there don't seem to be any official mirrors. However there are unofficial ones that provide original packages. Including those mirrors and doing a hash check could be the answer?

StrangePeanut avatar Aug 12 '22 18:08 StrangePeanut

a solution would be to download from mirrors if there are any?

I'm not aware of any official mirror, and for security reasons I wouldn't adopt any unofficial one...

mlocati avatar Aug 12 '22 21:08 mlocati

An alternative would be to download and build each extension. This is basically what pecl is doing anyway. The tricky part is handling latest/different versions.

eg:

curl -fsSL https://github.com/xdebug/xdebug/archive/refs/tags/$XDEBUG_VERSION.tar.gz -o xdebug.tar.gz \
    && mkdir -p /tmp/xdebug \
    && tar -xf xdebug.tar.gz -C /tmp/xdebug --strip-components=1 \
    && rm xdebug.tar.gz \
    && docker-php-ext-configure /tmp/xdebug --enable-xdebug \
    && docker-php-ext-install /tmp/xdebug \
    && rm -r /tmp/xdebug

cjunge avatar Aug 15 '22 21:08 cjunge

I'm not going to search where the source code resides for every extension, given also that it may change across time.

mlocati avatar Aug 15 '22 22:08 mlocati

Hmm still happening for me... so must be unrelated to the pecl servers. Seems hard to reproduce, I actually got 1 successful build but I need to be able to build this full container. I guess I'll keep trying. Has anybody found any workarounds?

EDIT: FYI after re-building again, it did compile successfully. I'm not sure if caching would be involved here (I'm using the same docker tag in a completely modified dockerfile, so I don't think so), but so far I'm able to get this built at least after a re-try.

MichaelMackus avatar Aug 18 '22 19:08 MichaelMackus

Also, it might help to add more messaging or information on why C-Make is failing... I looked in the log folder but there's not a simple "cmake.log" or anything I could find to specifically add to this issue, so wasn't sure where to find that.

MichaelMackus avatar Aug 18 '22 21:08 MichaelMackus

i run this individual to check wich extension fail:

RUN install-php-extensions pdo_mysql
RUN install-php-extensions Reflection
RUN install-php-extensions session
RUN install-php-extensions SimpleXML
RUN install-php-extensions SPL
RUN install-php-extensions sqlite3
RUN install-php-extensions gd
RUN install-php-extensions curl
RUN install-php-extensions imap
RUN install-php-extensions intl
RUN install-php-extensions json
RUN install-php-extensions mailparse
RUN install-php-extensions mbstring
RUN install-php-extensions readline
RUN install-php-extensions soap
RUN install-php-extensions xml
RUN install-php-extensions xmlrpc
RUN install-php-extensions zip
RUN install-php-extensions bz2
RUN install-php-extensions zlib
RUN install-php-extensions dba
RUN install-php-extensions ldap
RUN install-php-extensions xdebug

a solution may be to add something that allows a retry of the installation if it fails... about 3 times...

arcanisgk avatar Oct 14 '22 15:10 arcanisgk

I've got same error only with gd extension and only on docker desktop for windows with wsl 2 backend, may be it wil help to reproduce and fix this error

1Jackob1 avatar Oct 17 '22 15:10 1Jackob1

I've got same error only with gd extension and only on docker desktop for windows with wsl 2 backend, may be it wil help to reproduce and fix this error

i have use it:

RUN install-php-extensions pdo_mysql
RUN install-php-extensions Reflection
RUN install-php-extensions session
RUN install-php-extensions SimpleXML
RUN install-php-extensions SPL
RUN install-php-extensions sqlite3
RUN IPE_GD_WITHOUTAVIF=1 install-php-extensions gd
RUN install-php-extensions curl
RUN install-php-extensions imap
RUN IPE_ICU_EN_ONLY=1 install-php-extensions intl
RUN IPE_ICU_EN_ONLY=1 install-php-extensions http
RUN install-php-extensions json
RUN install-php-extensions mailparse
RUN install-php-extensions mbstring
RUN install-php-extensions readline
RUN install-php-extensions soap
RUN install-php-extensions xml
RUN install-php-extensions xmlrpc
RUN install-php-extensions bz2
RUN install-php-extensions zlib
RUN install-php-extensions dba
RUN install-php-extensions ldap
RUN install-php-extensions xdebug
RUN install-php-extensions @composer

arcanisgk avatar Oct 17 '22 16:10 arcanisgk

@arcanisgk thx!

1Jackob1 avatar Oct 18 '22 08:10 1Jackob1

I'm also having similar problems with different php-extensions. Here for example with zip:

FROM php:8.1-fpm-bullseye

RUN set -ex; \
  IPE_GD_WITHOUTAVIF=1 \
  install-php-extensions zip

Error during build in Dockerfile:

#22 92.30 + docker-php-ext-install -j12 zip
#22 92.30 make: *** No rule to make target 'zip', needed by 'all'.  Stop.
------
failed to solve: executor failed running [/bin/bash -c set -ex; IPE_GD_WITHOUTAVIF=1   install-php-extensions zip]: exit code: 2

The funny thing is.... skipping installing extensions in my custom build and running exactly the same command in the running docker-container works!

# docker-php-ext-install -j12 zip

It's driving me crazy as I'm juggling around on this now a few days trying to get it working. And always during Dockerfile build it's crashing, but running it in the build container works.

What can be the reason for this?!

typoworx-de avatar Feb 24 '23 09:02 typoworx-de

I also can't install some extensions (apcu/grpc/imagick, etc) Always the same error : #0 35.70 ### INSTALLING REMOTE MODULE apcu ### #0 35.86 No releases available for package "pecl.php.net/apcu" #0 35.86 install failed

chosroes avatar Apr 04 '23 08:04 chosroes

@chosroes

I also can't install some extensions (apcu/grpc/imagick, etc) Always the same error : #0 35.70 ### INSTALLING REMOTE MODULE apcu ### #0 35.86 No releases available for package "pecl.php.net/apcu" #0 35.86 install failed

It's maybe a transient problem caused by pecl.php.net website being down or inaccessible by you? What's the output of this command for you?

curl -sSLf -o /dev/null https://pecl.php.net/get/apcu

mlocati avatar Apr 04 '23 09:04 mlocati

curl -sSLf -o /dev/null https://pecl.php.net/get/apcu

Or even better:

curl -sSLf https://pecl.php.net/rest/r/apcu/allreleases.xml

mlocati avatar Apr 04 '23 09:04 mlocati

I get this :

<a xmlns="http://pear.php.net/dtd/rest.allreleases" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://pear.php.net/dtd/rest.allreleases http://pear.php.net/dtd/rest.allreleases.xsd">

apcu

pecl.php.net 5.1.22stable 5.1.21stable 5.1.20stable 5.1.19stable 5.1.18stable 5.1.17stable 5.1.16stable 5.1.15stable 5.1.14stable 5.1.13stable 5.1.12stable 5.1.11stable 5.1.10stable 5.1.9stable 5.1.8stable 5.1.7stable 5.1.6stable 5.1.5stable 5.1.4stable 4.0.11stable 5.1.3stable 5.1.2stable 4.0.10stable 5.1.0beta 4.0.8stable 4.0.7beta 4.0.6beta 4.0.5beta 4.0.4beta 4.0.3beta 4.0.2beta 4.0.1beta 4.0.0beta %

chosroes avatar Apr 04 '23 09:04 chosroes

image

chosroes avatar Apr 04 '23 09:04 chosroes

So, pecl is working for you (maybe it was a transient problem). Could you try to run install-php-extensions apcu again now?

mlocati avatar Apr 04 '23 09:04 mlocati

In my case I could not install xmlrpc, consistently over three tries.

install-php-extensions xmlrpc
...
#12 46.08 ### INSTALLING REMOTE MODULE xmlrpc ###
#12 46.08   (installing version beta)
#12 46.16 No releases available for package "pecl.php.net/xmlrpc"
#12 46.16 install failed

I am using php:8.1

qleroy avatar Apr 18 '23 14:04 qleroy

@qleroy Same answer as above

mlocati avatar Apr 18 '23 14:04 mlocati

Seems like this keeps happening at random. In my case different errors pop up when installing xdebug at random builds. Once I retry building my image a couple times everything goes ok. Weird stuff

It's either:

No releases available for package "pecl.php.net/xdebug"

or

Package "xdebug" does not have REST info xml available

akserikawa avatar May 24 '23 13:05 akserikawa

That's caused by network problems (likely the pecl webserver is down).

There's nothing I can do about that.

mlocati avatar May 24 '23 14:05 mlocati

I'm still thinking about the possibility of a validation interface prior to the installation of packages that validates which packages have problems... the truth is that I like to do it through the terminal when I work with linux but it s[t]uck when errors appear in the middle of an installation from docker... when trying to run an automated install script...

the time is gold...

arcanisgk avatar May 24 '23 17:05 arcanisgk

A few months ago I used this: https://github.com/arcanisgk/docker-lamp-stack I want to think that the extension repositories are still working correctly.

arcanisgk avatar May 24 '23 17:05 arcanisgk