gpt4 book ai didi

php - Docker 安装带有 Memcache 扩展的 PHP-7-fpm?失败并显示 Cannot find config.m4

转载 作者:太空狗 更新时间:2023-10-29 14:29:18 25 4
gpt4 key购买 nike

我正在尝试使用支持 memcache 的 PHP 7.0 版安装 Docker,我的 docker 文件如下所示,但是它失败了@STEP 10 并出现错误

Step 10 : RUN /usr/bin/phpize
---> Running in 450678a59cd4
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

[31mERROR[0m: Service 'php' failed to build: The command '/bin/sh -c /usr/bin/phpize' returned a non-zero code: 1

Docker文件如下

FROM php:7.0-fpm
#FROM php:5.6-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd

RUN docker-php-ext-install mysqli mbstring pdo_mysql

# Download and Installing php libraries
RUN apt-get -y install php-pear php5-dev

# Download and Installing git and vim
RUN apt-get -y install git vim gcc

# Download and Installing zip unzip
RUN apt-get -y install zip unzip

# install PHP PEAR extensions
RUN apt-get -y install wget

#RUN wget http://pecl.php.net/get/memcache-3.0.9-dev.tgz && gunzip memcache-3.0.9-dev.tgz && tar -xvf memcache-3.0.9-dev.tar && cd memcache-3.0.9-dev \
# && phpize && ./configure && make && make install

# RUN git clone https://github.com/websupport-sk/pecl-memcache && cd pecl-memcache

RUN apt-get -y install libmemcached-dev libmemcached11
RUN git clone https://github.com/php-memcached-dev/php-memcached && cd php-memcached && git checkout -b php7 origin/php7
RUN /usr/bin/phpize
RUN ./configure && make && make install

RUN apt-get install -y memcached

EXPOSE 9000

COPY ./www.conf /etc/php-fpm.d/www.conf
COPY ./php.ini /etc/php.ini
COPY ./php-fpm.conf /etc/php-fpm.conf
COPY ./40-memcache.ini /etc/php.d/40-memcache.ini

#COPY bootstrap.sh /opt/bootstrap.sh
#RUN chmod +x /opt/bootstrap.sh
#ENTRYPOINT ["/opt/bootstrap.sh"]

最佳答案

您的 Dockerfile 应如下所示:

PHP-FPM Dockerfile:

FROM php:7.0-fpm

# ...

RUN apt-get update && apt-get install -y \
libpq-dev \
libmemcached-dev \
curl

# ...

# Install Memcached for php 7
RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
&& mkdir -p /usr/src/php/ext/memcached \
&& tar -C /usr/src/php/ext/memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
&& docker-php-ext-configure memcached \
&& docker-php-ext-install memcached \
&& rm /tmp/memcached.tar.gz


# ...

CMD ["php-fpm"]

EXPOSE 9000

Memcached Dockerfile:

FROM memcached:latest

CMD ["memcached"]

EXPOSE 11211

这取自https://github.com/LaraDock/laradock

关于php - Docker 安装带有 Memcache 扩展的 PHP-7-fpm?失败并显示 Cannot find config.m4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36466997/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com