I have an app with Docker, and I am trying to install memcached with php7-fpm.
According to official docker documentation I have in my Dockerfile:
# PHP Version
FROM php:7.0-fpm
...
# Install Memcached
RUN apt-get install -y libmemcached-dev && \
pecl install memcached && \
docker-php-ext-enable memcached
But I got this error:
pecl/memcached requires PHP (version >= 5.2.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.0.9
I don't want to switch to PHP 5.6. Any ideas?
We build the memcache extension from scratch when building our php7 container. Maybe our approached helps you or points you to the right direction. The documentation in the Dockerhub really seems to be faulty, tried pecl and it didn't work here either.
So this is how it looks in our Dockerfile:
RUN apt-get update && apt-get install -y
libmemcached11 \
libmemcachedutil2 \
libmemcached-dev \
libz-dev \
git \
&& cd /root \
&& git clone -b php7 https://github.com/php-memcached-dev/php-memcached \
&& cd php-memcached \
&& phpize \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -rf php-memcached \
&& echo extension=memcached.so >> /usr/local/etc/php/conf.d/memcached.ini \
&& apt-get remove -y build-essential libmemcached-dev libz-dev \
&& apt-get remove -y libmemcached-dev libz-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean