docker-php添加memcached扩展

环境及版本
php: php:5-fpm-alpine
memcached: 2.2.0

方式一: PECL安装
## Dockerfile

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-2.2.0 \
    && echo "extension=memcached.so" > /usr/local/etc/php/conf.d/memcached.ini \
    && rm -rf /usr/share/php \
    && rm -rf /tmp/* \
    && apk del .memcached-deps .phpize-deps

完整Dockerfile

相关资料

PECL-memcached
PEAR-memcached
How can I install the php memcached
alpine-php5相关扩展安装示例
memcached-源码安装示例

发表评论