![使用 Plesk Ubuntu Server 安装 Memcached 时出错](https://linux22.com/image/788326/%E4%BD%BF%E7%94%A8%20Plesk%20Ubuntu%20Server%20%E5%AE%89%E8%A3%85%20Memcached%20%E6%97%B6%E5%87%BA%E9%94%99.png)
我们正在努力让新的 Ubuntu Plesk 服务器运行 memcached,但在为 PHP 设置它时不断遇到错误。
使用来自 Plesk 的说明我们成功运行了以下操作:
apt install memcached autoconf automake gcc libmemcached-dev libhashkit-dev pkg-config plesk-php*-dev zlib1g-dev make
但是,当我们尝试安装 PHP 扩展时(在我们的例子中是 PHP 8.1),我们遇到了一个问题
/opt/plesk/php/8.1/bin/pecl install memcached
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/memcached can optionally use PHP extension "igbinary" (version >= 2.0)
pecl/memcached can optionally use PHP extension "msgpack" (version >= 2.0)
downloading memcached-3.2.0.tgz ...
Starting to download memcached-3.2.0.tgz (90,722 bytes)
.....................done: 90,722 bytes
18 source files, building
running: phpize
Configuring for:
PHP Api Version: 20210902
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
configure.ac:18: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
build/php.m4:2111: PHP_CONFIG_NICE is expanded from...
configure.ac:18: the top level
configure.ac:161: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:161: You should run autoupdate.
build/libtool.m4:99: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
libmemcached directory [no] :
zlib directory [no] :
use system fastlz [no] :
enable igbinary serializer [no] :
enable msgpack serializer [no] :
enable json serializer [no] :
enable server protocol [no] :
enable sasl [yes] :
enable sessions [yes] :
building in /tmp/pear-build-rootFGnoXE/memcached-3.2.0
running: /tmp/memcached/configure --with-php-config=/opt/plesk/php/8.1/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
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /opt/plesk/php/8.1
checking for PHP includes... -I/opt/plesk/php/8.1/include/php -I/opt/plesk/php/8.1/include/php/main -I/opt/plesk/php/8.1/include/php/TSRM -I/opt/plesk/php/8.1/include/php/Zend -I/opt/plesk/php/8.1/include/php/ext -I/opt/plesk/php/8.1/include/php/ext/date/lib
checking for PHP extension directory... /opt/plesk/php/8.1/lib/php/modules
checking for PHP installed headers prefix... /opt/plesk/php/8.1/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking whether to enable memcached support... yes, shared
checking for libmemcached... yes, shared
checking whether to enable memcached session handler support... yes
checking whether to enable memcached igbinary serializer support... no
checking whether to enable memcached json serializer support... no
checking whether to enable memcached msgpack serializer support... no
checking whether to enable memcached sasl support... yes
checking whether to enable memcached protocol support... no
checking whether to use system FastLZ library... no
checking for ZLIB... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking for zlib location... /usr
checking for session includes... /opt/plesk/php/8.1/include/php
checking for memcached session support... enabled
checking for memcached igbinary support... disabled
checking for memcached msgpack support... disabled
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/memcached/configure --with-php-config=/opt/plesk/php/8.1/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
我注意到它在开始时引用了 pecl 通道的一个错误,因此我运行了:
pecl channel-update pecl.php.net
但之后的结果还是一样。
Ubuntu 22.04.3 LTS
Plesk Obsidian 18.0.54
答案1
您可以尝试先运行“apt-get install libmemcached-tools”