显然,有人已经忘记了亚马逊网络服务的php-zip扩展。amazon- Linux -extras php7.4存储库中没有适用于Amazon linux 2的php-zip扩展。有人知道怎么安装php-zip扩展吗?这是非常关键的,因为很多库都需要这个扩展。
我已经试过了,但没有成功。看起来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将其作为预编译的二进制文件提供。
发布于 2020-03-21 05:39:06
安装它最简单的方法就是暂时抛弃amazon-linux-extras php7.4,使用EPEL / REMI repos,直到Amazon添加这个扩展。我不认为他们会这样做,因为这已经是一个问题一段时间了。
你也许可以使用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 'https://stackoverflow.com/questions/60780822
复制相似问题