I have pretty simple dockerfile
FROM php:7.0-fpm
RUN apt-get clean
&& apt-get update && pecl install memeched
But unfortunately I am getting error:
pecl/memcached requires PHP (version >= 5.2.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.0.12
Why is that?
memcached does not have a php7 release yet.
As an alternative you can use the php7 branch from the git repo.
FROM php:7.0-fpm
RUN apt-get update \
&& apt-get install -y \
libmemcached11 \
libmemcachedutil2 \
build-essential \
libmemcached-dev \
libz-dev \
git \
&& git clone -b php7 https://github.com/php-memcached-dev/php-memcached.git /usr/src/php/ext/memcached \
&& cd /usr/src/php/ext/memcached \
&& phpize \
&& ./configure \
&& make all \
&& docker-php-ext-install memcached \
&& docker-php-ext-enable memcached
The comments on the issue I linked do seem to indicate that you might experience some issues during use.
Memcached now has stable PHP 7 release, so now it can be included in docker-php-ext-install, can not?
This will install stable memcached and igbinary (for more effective serialization) extensions:
RUN apt-get update && apt-get install -y libmemcached \
&& apt-get clean \
&& yes '' | pecl install igbinary memcached \
&& pecl clear-cache \
&& docker-php-ext-enable igbinary.so memcached.so
Confirmed working with recent versions of the memcached PECL extension! :+1:
Most helpful comment
This will install stable memcached and igbinary (for more effective serialization) extensions: