1

我使用 docker-compose version: '3' 并且需要安装php-amqplib. 我遇到了奇怪的行为。抛出关于丢失的异常sockets,但我安装并添加到我的 composer.json,如何安装php-amqplib

FROM php:7.4-fpm-alpine

LABEL maintainer="Vincent Composieux <vincent.composieux@gmail.com>"

RUN apk add --update --no-cache \
    coreutils \
    yarn \
    php7-fpm \
    php7-apcu \
    php7-ctype \
    php7-curl \
    php7-dom \
    php7-gd \
    php7-iconv \
    php7-imagick \
    php7-json \
    php7-intl \
    php7-mcrypt \
    php7-fileinfo\
    php7-mbstring \
    php7-opcache \
    php7-openssl \
    php7-pdo \
    php7-pdo_mysql \
    php7-mysqli \
    php7-pdo_pgsql \
    php7-pgsql \
    php7-xml \
    php7-zlib \
    php7-phar \
    php7-tokenizer \
    php7-session \
    php7-simplexml \
    php7-xdebug \
    php7-zip \
    php7-xmlwriter \
    make \
    curl \
    zlib-dev \
    libxml2-dev \
    rabbitmq-c-dev \
    oniguruma-dev \
    php7-pecl-amqp \
    php7-amqp \
    php7-redis


# Extensions
RUN echo "Extensions install - start" \
    # Sockets
    && docker-php-ext-install sockets \
    # Amqp
    && apk add --no-cache --update rabbitmq-c-dev \
    && apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS \
    && pecl install -o -f amqp \
    && docker-php-ext-enable amqp \
    && apk del .phpize-deps \
    #
    && echo "Extensions install - finish"

RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ php7-pecl-mongodb

RUN echo "$(curl -sS https://composer.github.io/installer.sig) -" > composer-setup.php.sig \
        && curl -sS https://getcomposer.org/installer | tee composer-setup.php | sha384sum -c composer-setup.php.sig \
        && php composer-setup.php && rm composer-setup.php* \
        && chmod +x composer.phar && mv composer.phar /usr/bin/composer

COPY symfony.ini /etc/php7/conf.d/
COPY symfony.ini /etc/php7/cli/conf.d/
COPY xdebug.ini  /etc/php7/conf.d/

COPY symfony.pool.conf /etc/php7/php-fpm.d/

CMD ["php-fpm7", "-F"]

WORKDIR /var/www/symfony
EXPOSE 9001


composer require php-amqplib/php-amqplib


Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-sockets * is missing from your system. Install or enable PHP's sockets extension.
  Problem 2
    - php-amqplib/php-amqplib v2.12.0 requires ext-sockets * -> the requested PHP extension sockets is missing from your system.
    - php-amqplib/php-amqplib 2.12.x-dev requires ext-sockets * -> the requested PHP extension sockets is missing from your system.
    - Installation request for php-amqplib/php-amqplib ^2.12@dev -> satisfiable by php-amqplib/php-amqplib[2.12.x-dev, v2.12.0].

composer.json 的一部分

"require": {
    "php": "^7.2.5",
    "ext-amqp": "*",
    "ext-ctype": "*",
    "ext-iconv": "*",
    "ext-json": "*",
    "ext-mongodb": "*",
    "ext-openssl": "*",
    "ext-pdo": "*",
    "ext-redis": "*",
    "ext-sockets": "*",
    "ext-zip": "*",
4

0 回答 0