Problem adding Memcached support in Docker for PHP8.1 using bookworm
Asked Answered
E

2

5

I have a Dockerfile relying on PHP:8.1-apache, running since months.

Once PHP:8.1-apache started to use Debian bookworm, the memcached client started to give an error while building the image.

The Dockerfile rows involved are

FROM php:8.1-apache

...

RUN apt-get update --fix-missing -q \
    && apt-get install -y curl mcrypt gnupg build-essential software-properties-common wget vim zip unzip libxml2-dev libz-dev libpng-dev libmemcached-dev \
    && pecl install memcached \
    && docker-php-ext-enable memcached \

...

The error at image build time is:

checking for libmemcached location... configure: error: memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located
ERROR: `/tmp/pear/temp/memcached/configure --with-php-config=/usr/local/bin/php-config --with-libmemcached-dir=no --with-zlib-dir=no --with-system-fastlz=no --enable-memcached-igbinary=no --enable-memcached-msgpack=no --enable-memcached-json=no --enable-memcached-protocol=no --enable-memcached-sasl=yes --enable-memcached-session=yes' failed

Pinning the oldstable version solves the problem,

FROM php:8.1-apache-bullseye

And that clearly indicates that the issue is caused by the switch to new Debian Version.

What could be done to use bookworm and continue to use the same libraries and process ?

Erde answered 16/6, 2023 at 12:59 Comment(0)
E
15

Ensure these libraries are installed (in particular, libssl-dev):

RUN apt install -y libmemcached-dev zlib1g-dev libssl-dev

Credit to AKorezin: https://github.com/php-memcached-dev/php-memcached/issues/541#issuecomment-1624041385

Then you can follow the usual PECL install process:

RUN yes '' | pecl install -f memcached-3.2.0 \
  && docker-php-ext-enable memcached
Exsert answered 7/7, 2023 at 4:37 Comment(0)
S
0

Add this two missing libraries in the Dockerfile:

RUN apt-get install -y libmemcached-dev libmemcached11
Sixfooter answered 16/6, 2023 at 14:31 Comment(1)
Thanks Alez, but sadly the error is still the sameErde

© 2022 - 2024 — McMap. All rights reserved.