<small id='SH6Qh'></small><noframes id='SH6Qh'>

<legend id='SH6Qh'><style id='SH6Qh'><dir id='SH6Qh'><q id='SH6Qh'></q></dir></style></legend>
    <tfoot id='SH6Qh'></tfoot>

          <bdo id='SH6Qh'></bdo><ul id='SH6Qh'></ul>
      1. <i id='SH6Qh'><tr id='SH6Qh'><dt id='SH6Qh'><q id='SH6Qh'><span id='SH6Qh'><b id='SH6Qh'><form id='SH6Qh'><ins id='SH6Qh'></ins><ul id='SH6Qh'></ul><sub id='SH6Qh'></sub></form><legend id='SH6Qh'></legend><bdo id='SH6Qh'><pre id='SH6Qh'><center id='SH6Qh'></center></pre></bdo></b><th id='SH6Qh'></th></span></q></dt></tr></i><div id='SH6Qh'><tfoot id='SH6Qh'></tfoot><dl id='SH6Qh'><fieldset id='SH6Qh'></fieldset></dl></div>

        如何在 Docker 的 PHP7 Alpine 映像上安装 php memcached 扩展?

        时间:2024-05-11
        <i id='MlpA2'><tr id='MlpA2'><dt id='MlpA2'><q id='MlpA2'><span id='MlpA2'><b id='MlpA2'><form id='MlpA2'><ins id='MlpA2'></ins><ul id='MlpA2'></ul><sub id='MlpA2'></sub></form><legend id='MlpA2'></legend><bdo id='MlpA2'><pre id='MlpA2'><center id='MlpA2'></center></pre></bdo></b><th id='MlpA2'></th></span></q></dt></tr></i><div id='MlpA2'><tfoot id='MlpA2'></tfoot><dl id='MlpA2'><fieldset id='MlpA2'></fieldset></dl></div>

        • <small id='MlpA2'></small><noframes id='MlpA2'>

              <tbody id='MlpA2'></tbody>
          1. <legend id='MlpA2'><style id='MlpA2'><dir id='MlpA2'><q id='MlpA2'></q></dir></style></legend>

                <bdo id='MlpA2'></bdo><ul id='MlpA2'></ul>
                <tfoot id='MlpA2'></tfoot>

                • 本文介绍了如何在 Docker 的 PHP7 Alpine 映像上安装 php memcached 扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  官方的php7 docker镜像有以下示例:

                  The official php7 docker image has the following example:

                  FROM php:7.0-fpm
                  RUN apt-get update && apt-get install -y libmemcached-dev 
                      && pecl install memcached 
                      && docker-php-ext-enable memcached
                  

                  我正在尝试使用 FROM php:7.0-fpm-alpine:

                  RUN apk add --update --no-cache libmemcached-dev
                  RUN      pecl install memcached && docker-php-ext-enable memcached
                  

                  PECL 给出这个错误:

                  PECL gives this error:

                  pecl/memcached 需要 PHP(版本 >= 5.2.0,版本 <= 6.0.0,排除版本:6.0.0),安装版本为 7.0.13

                  pecl/memcached requires PHP (version >= 5.2.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.0.13

                  如何在 alpine 上安装 memcached php 扩展?

                  How can I install the memcached php extension on alpine?

                  推荐答案

                  目前php-memcached-dev:php7 分支包含此扩展的源代码.

                  Currently the php-memcached-dev:php7 branch contains the source for this extension.

                  要安装它,您仍然可以使用 docker-php-ext-* 命令,但您需要自己检查源代码.

                  To install it you can still use the docker-php-ext-* commands but you need to checkout the source yourself.

                  假设安装扩展所需的一切都已安装,您可以执行以下操作:

                  Assuming everything required to install the extension is already installed you can do:

                  RUN git clone -b php7 https://github.com/php-memcached-dev/php-memcached /usr/src/php/ext/memcached 
                      && docker-php-ext-configure /usr/src/php/ext/memcached 
                          --disable-memcached-sasl 
                      && docker-php-ext-install /usr/src/php/ext/memcached 
                      && rm -rf /usr/src/php/ext/memcached
                  

                  此块将克隆存储库,配置和安装扩展,然后自行清理.

                  This block will clone the repository, configure and install the extension then clean up after it self.

                  您很可能需要安装到包来构建扩展,我们可以通过以下方式添加和删除它们:

                  It is most likely that you need to install to packages to build the extension, we can add and remove them by doing:

                  ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev git
                  RUN set -xe 
                      && apk add --no-cache libmemcached-libs zlib 
                      && apk add --no-cache 
                          --virtual .memcached-deps 
                          $MEMCACHED_DEPS 
                      && git clone -b php7 https://github.com/php-memcached-dev/php-memcached /usr/src/php/ext/memcached 
                      && docker-php-ext-configure /usr/src/php/ext/memcached 
                          --disable-memcached-sasl 
                      && docker-php-ext-install /usr/src/php/ext/memcached 
                      && rm -rf /usr/src/php/ext/memcached 
                      && apk del .memcached-deps
                  

                  <小时>

                  2017 年 5 月 17 日更新

                  memcached 现已添加到 php7 的官方 pecl 库中(v3 -> php7/7.1, v2 -> php5)

                  memcached has been added to the official pecl libraries for php7 now (v3 -> php7/7.1, v2 -> php5)

                  这使得安装有点不同

                  FROM php:7.0-alpine
                  
                  ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev
                  RUN apk add --no-cache --update libmemcached-libs zlib
                  RUN set -xe 
                      && apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS 
                      && apk add --no-cache --update --virtual .memcached-deps $MEMCACHED_DEPS 
                      && pecl install memcached 
                      && echo "extension=memcached.so" > /usr/local/etc/php/conf.d/20_memcached.ini 
                      && rm -rf /usr/share/php7 
                      && rm -rf /tmp/* 
                      && apk del .memcached-deps .phpize-deps
                  

                  这篇关于如何在 Docker 的 PHP7 Alpine 映像上安装 php memcached 扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在一个 dockerfile 中结合 PHP-fpm 和 nginx 下一篇:Docker-Compose 不会卷我的 php.ini 文件

                  相关文章

                  1. <legend id='sgTtv'><style id='sgTtv'><dir id='sgTtv'><q id='sgTtv'></q></dir></style></legend>
                    • <bdo id='sgTtv'></bdo><ul id='sgTtv'></ul>

                    <small id='sgTtv'></small><noframes id='sgTtv'>

                    <i id='sgTtv'><tr id='sgTtv'><dt id='sgTtv'><q id='sgTtv'><span id='sgTtv'><b id='sgTtv'><form id='sgTtv'><ins id='sgTtv'></ins><ul id='sgTtv'></ul><sub id='sgTtv'></sub></form><legend id='sgTtv'></legend><bdo id='sgTtv'><pre id='sgTtv'><center id='sgTtv'></center></pre></bdo></b><th id='sgTtv'></th></span></q></dt></tr></i><div id='sgTtv'><tfoot id='sgTtv'></tfoot><dl id='sgTtv'><fieldset id='sgTtv'></fieldset></dl></div>
                    <tfoot id='sgTtv'></tfoot>