<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 扩展?

        How can I install the php memcached extension on Docker#39;s PHP7 Alpine image?(如何在 Docker 的 PHP7 Alpine 映像上安装 php memcached 扩展?)
        <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 扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How do I parse XML containing custom namespaces using SimpleXML?(如何使用 SimpleXML 解析包含自定义命名空间的 XML?)
                  SimpleXML SOAP response Namespace issues(SimpleXML SOAP 响应命名空间问题)
                  Problems with PHP namespaces and built-in classes, how to fix?(PHP 命名空间和内置类的问题,如何解决?)
                  Use php namespace inside function(在函数内部使用 php 命名空间)
                  unexpected #39;use#39; (T_USE) when trying to use composer(尝试使用作曲家时意外的“使用(T_USE))
                  PHP adding custom namespace using autoloader from composer(PHP使用来自作曲家的自动加载器添加自定义命名空间)

                        <tbody id='sgTtv'></tbody>

                      <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>