0

I try to install php extension in my container (debian Buster), but i have a lot off issues :

E: Package 'php7.3-XXXX' has no installation candidate

FROM php:7.3-apache

RUN apt-get upgrade -y && apt-get update -y
RUN apt-get install -y \
       git \
       vim \
       curl \
       bash \
       software-properties-common \
       lsb-release \
       gnupg

RUN apt-get install -y \
        libzip-dev \
        zip \
  && docker-php-ext-install zip

RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee -a /etc/apt/sources.list.d/php.list \
    && curl https://packages.sury.org/php/apt.gpg | apt-key add - \
    && apt-get update -qq \
    && DEBIAN_FRONTEND=noninteractive apt install -y \
    php7.3-common \
    php7.3-cli \
    php7.3-mysql \
    php7.3-curl \
    php7.3-xml \
    php7.3-mbstring \
    php7.3-intl \
    php7.3-zip \
    php7.3-json \
    php7.3-gd

ENV COMPOSER_ALLOW_SUPERUSER=1
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

WORKDIR /var/www/html/

COPY ./ /var/www/html/

RUN chmod +rwx /var/www/html/prestashop.zip

CMD ["apachectl", "-D", "FOREGROUND"]

I have trying install without extension packages. Same issues.

I can't understand why I can't install PHP extensions. I have the same problems no matter what PHP image I use.

There's one thing I must be missing.

Any ideas ?

Thx

N Ma
  • 29
  • 2
  • 8

1 Answers1

-2

Use the docker-php-ext-install instead of the apt install php7.3-XXX (you are already using it to install the zip extension`).

In the PHP Docker documentation there is an explanation on how to use it on topic How to install more PHP extensions.

So your dockerfile should be something like this:

#...
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee -a /etc/apt/sources.list.d/php.list \
    && curl https://packages.sury.org/php/apt.gpg | apt-key add - \
    && apt-get update -qq \
    && docker-php-ext-install mysqli \
    curl \
    xml \
    mbstring \
    intl \
    zip \
    json \
    gd
#...

Note that I'm not installing the common (no need for installing), nor the cli lib. If you need the cli library I suggest reading this tutorial: How to install PHP extension into cli.

Your Docker seems to have some other issues, including with cURL (this topic might help) and with https://packages.sury.org/php signature, but those topics are too above the asked.

bpanatta
  • 509
  • 3
  • 12