memcached docker 安装在 Debian 11 中有效,但在 Debian 12 中失败
RUN apt-get update && apt-get install -y libmemcached-dev zlib1g-dev \
&& pecl install memcached \
&& docker-php-ext-enable memcached
...
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
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
# php -v
PHP 8.1.20 (cli) (built: Jun 14 2023 05:48:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.20, Copyright (c) Zend Technologies
with Zend OPcache v8.1.20, Copyright (c), by Zend Technologies
如何安装?
由于 memcached 库的版本较新,您还需要在安装 pecl 之前安装这些软件包:
RUN apt-get install -y zlib1g-dev libssl-dev
这解决了我的同类图像问题
FROM php:8.2-fpm
。它曾经一直有效,直到基础镜像升级到 Debian 12。