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
I'm trying to use FROM php:7.0-fpm-alpine
:
RUN apk add --update --no-cache libmemcached-dev
RUN pecl install memcached && docker-php-ext-enable memcached
PECL gives this error:
pecl/memcached requires PHP (version >= 5.2.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.0.13
How can I install the memcached php extension on alpine?
PHP License. Description. Memcached is a caching daemon designed especially for. dynamic web applications to decrease database load by. storing objects in memory.
Docker is the industry standard for running containerised applications. By using a docker container you can create a consistent install of PHP that can be run locally or remotely without needing to install it on the underlying operating system.
Try it.
FROM php:7.2.10-fpm-alpine3.7
# Install PHP Extensions (igbinary & memcached)
RUN apk add --no-cache --update libmemcached-libs zlib
RUN set -xe && \
cd /tmp/ && \
apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS && \
apk add --no-cache --update --virtual .memcached-deps zlib-dev libmemcached-dev cyrus-sasl-dev && \
# Install igbinary (memcached's deps)
pecl install igbinary && \
# Install memcached
( \
pecl install --nobuild memcached && \
cd "$(pecl config-get temp_dir)/memcached" && \
phpize && \
./configure --enable-memcached-igbinary && \
make -j$(nproc) && \
make install && \
cd /tmp/ \
) && \
# Enable PHP extensions
docker-php-ext-enable igbinary memcached && \
rm -rf /tmp/* && \
apk del .memcached-deps .phpize-deps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With