【问题标题】:Amazon-linux-extras PHP 7.4 repo missing php-zip extensionAmazon-linux-extras PHP 7.4 repo 缺少 php-zip 扩展
【发布时间】:2020-07-01 23:36:40
【问题描述】:

显然有人忘记了 AWS 的 php-zip 扩展。 amazon-linux-extras php7.4 存储库中没有可用于 Amazon Linux 2 的 php-zip 扩展。有人知道如何安装 php-zip 扩展吗?这非常关键,因为许多库都需要此扩展。

我已经通过 Pecl 尝试过,但没有成功。 Amazon Linux 2 上的底层软件包似乎与 Pecl 安装方法不兼容。

/bin/sh /var/tmp/pear-build-defaultuserQfyCvq/zip-1.13.5/libtool --mode=compile cc  -I. -I/var/tmp/zip -DPHP_ATOM_INC -I/var/tmp/pear-build-defaultuserQfyCvq/zip-1.13.5/include -I/var/tmp/pear-build-defaultuserQfyCvq/zip-1.13.5/main -I/var/tmp/zip -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/var/tmp/zip/lib -I/var/tmp/zip/php7  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/zip/php7/php_zip.c -o php7/php_zip.lo
libtool: compile:  cc -I. -I/var/tmp/zip -DPHP_ATOM_INC -I/var/tmp/pear-build-defaultuserQfyCvq/zip-1.13.5/include -I/var/tmp/pear-build-defaultuserQfyCvq/zip-1.13.5/main -I/var/tmp/zip -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/var/tmp/zip/lib -I/var/tmp/zip/php7 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/zip/php7/php_zip.c  -fPIC -DPIC -o php7/.libs/php_zip.o
/var/tmp/zip/php7/php_zip.c: In function 'php_zip_pcre'

更新:Pecl 方法的工作原理如下:

yum install php-devel* gcc libzip php-libzip libzip-devel zlip zip php-pear
pecl install zip

但是,这对于任何生产服务器来说都不是理想的方法。仍在等待 AWS 将其作为预编译的二进制文件提供。

【问题讨论】:

  • Zip 扩展不可用......对于 7.4。你可以运行 yum list | grep php 确认。我已经向亚马逊开放了票,目前他们声称它包含在 php-common 中,但在我的实例中不确定。一旦收到 AWS 的回复,我将发布更新

标签: php amazon-linux-2


【解决方案1】:

安装它的最简单方法是暂时放弃 amazon-linux-extras php7.4 并改用 EPEL / REMI 存储库,直到亚马逊添加扩展。我不会指望他们会这样做,因为这已经是一个问题了。

你也许可以使用 Pecl 和大量的肘部油脂来完成这项工作,你还会使用各种额外的库(如 GCC、Make、libzip 等)使你的系统膨胀……

以下是使用 Amazon Linux 2 与 Epel 和 Remi 构建 docker 容器的方法:

FROM amazonlinux:latest

ENTRYPOINT /opt/remi/php74/root/usr/sbin/php-fpm --nodaemonize

ENV TERM=xterm-256color
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV COMPOSER_HOME=/var/www/html
ENV PATH=$PATH:vendor/bin:/usr/local/bin:/opt/remi/php74/root/usr/bin

# Grab node RPM and enable Epel and Remi repos
RUN curl -sL https://rpm.nodesource.com/setup_12.x | bash - \
 && yum install -y \
 https://rpms.remirepo.net/enterprise/remi-release-7.rpm \
 https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
 yum-utils \
 && yum-config-manager enable epel \
 && yum-config-manager enable remi

RUN yum install -y \
    ruby \
    nodejs \
    php74-php \
    php74-php-fpm \
    php74-php-common \
    php74-php-cli \
    php74-php-json \
    php74-php-process \
    php74-php-xml \
    php74-php-gd \
    php74-php-gmp \
    php74-php-mysqlnd \
    php74-php-mbstring \
    php74-php-opcache \
    php74-php-pecl-zip \
    python2-pip

# Install some common dev tools on the host
RUN yum install -y \
    which \
    telnet \
    vim

# Install setup tools and AWS cli
RUN pip install setuptools awscli

# Install composer
RUN curl -sS https://getcomposer.org/installer | php && chmod 755 composer.phar && mv composer.phar /usr/local/bin/composer

# Install configuration files
COPY php-fpm/php.ini /etc/opt/remi/php74/php.ini
COPY php-fpm/www.conf /etc/opt/remi/php74/php-fpm.d/www.conf
COPY php-fpm/php-fpm.conf /etc/opt/remi/php74/php-fpm.conf

# Create folder php fpm logs we want to have log files in standard location
RUN mkdir /var/log/php-fpm

# Create user that PHP-FPM runs under
RUN groupadd php-fpm && useradd php-fpm --system --no-create-home -g php-fpm

# Give us nice prompt so we know which container we are on
ENV PS1='php-fpm \w '

【讨论】:

    猜你喜欢
    • 2020-11-19
    • 1970-01-01
    • 1970-01-01
    • 2018-05-10
    • 2021-12-03
    • 1970-01-01
    • 2016-07-31
    • 1970-01-01
    • 2020-02-08
    相关资源
    最近更新 更多