Score:3

memcached support requires libmemcached

sb flag

We've configured a Dockerfile containing the following code snippet:

ENV MEMCACHE_VERSION=8.0 \
    MEMCACHED_VERSION=3.2.0

############## END ENVIRONMENT VARIABLES ###############
########################################################

RUN apt-get update && apt-get install -y --no-install-recommends \
    zlib1g-dev \
    zlib1g \
    libmemcached11 \
    libmemcachedutil2 \
    libmemcached-dev \
    libmagickwand-dev 

RUN pecl install memcache-$MEMCACHE_VERSION && \
    pecl install memcached-$MEMCACHED_VERSION && \
    pecl install imagick

But yesterday starting from 17:00 after running docker compose up --build -d --force-recreate all of a sudden the following error started occuring. Note: This did not happen before 17:00, the whole day it worked just fine.

 => ERROR [builder 3/3] RUN pecl install memcache-8.0 &&     pecl install memcached-3.2.0 &&     pecl install imagick                   15.1s

#0 15.03 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
#0 15.06 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
------
failed to solve: process "/bin/sh -c pecl install memcache-$MEMCACHE_VERSION &&     pecl install memcached-$MEMCACHED_VERSION &&     pecl install imagick" did not complete successfully: exit code: 1

I want to repeat that we haven't changed anything in the Dockerfile and this started happening to my other colleagues docker environments as well as if something has changed in the libmemcached or memcached modules since yesterday around this time.

What we've already tried:

  • Using the option behind the commands -with-libmemcached-dir=/usr/include/libmemcached
  • Updating Docker Desktop
  • Install libmemcached manually on the docker container and uncommenting the memcache/memcached/imagick installs code below to see if libmemcached was installer for real. libmemcached was present in the folder /usr/include/libmemcached. Running the memcached installation right after resulted in the same error
  • Freak out and stare at the screen hoping it will go away
djdomi avatar
za flag
and what is the business related question or issue in here?
Score:7
tm flag

What version of PHP are you using? We had this issue ourselves, and it seemed to be tied to the Docker image tag php:8.1-fpm.

https://hub.docker.com/layers/library/php/8.1-fpm/images/sha256-4bb4c92e2b4ed0f58997835c29c206f2e9c8f1e3ee29677cf1fd86affda1e99d?context=explore

This image is in turn built on Debian, which just a few days ago had a new version released (12 - Bookworm, vs the prior 11 - Bullseye). Bookworm jumped the libmemcached-dev version from 1.0.18 to 1.1.4, but for some reason 1.1.4 doesn't seem to be installing properly, thus pecl can't find the right header file.

https://packages.debian.org/bullseye/libmemcached-dev https://packages.debian.org/bookworm/libmemcached-dev

We were able to resolve the build issue by changing our tag from php:8.1-fpm to php:8.1-fpm-bullseye to go back to the Bullseye Debian version, where libmemcached-dev 1.0.18 continues to work just fine.

IT-Girl avatar
sb flag
Thank you so much for your comment, we're using PHP version 8.2 , which is using php:8.2-fpm. I'm gonna look into it now
visit1985 avatar
us flag
Same for php:8.2-apache. Switched to php:8.2-apache-bullseye.
Beto Aveiga avatar
in flag
This answer saved my day today :D Thank you all!
Score:3
cn flag

If you wish to use Debian Bookworm, I got memcached working by installing libssl-dev also.

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
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.