pecl 安装 memcached - 在“/opt/homebrew/opt/zlib/include”下找不到 ZLIB 标头

问题描述 投票:0回答:1

我在装有 Apple 芯片的 Mac 上使用 Homebrew 安装了 PHP、zlib 和 memcached。我正在尝试使用

安装 PHP 的 memcached 扩展
sudo pecl install memcached

当它提示我

zlib directory [no] :
时,我指定了
"/opt/homebrew/opt/zlib/include"

我已确认此目录包含文件 zlib.h 和 zconf.h。

brew info zlib
也告诉我

For compilers to find zlib you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/zlib/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/zlib/include"

For pkg-config to find zlib you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig"

所以我似乎为 zlib 提供了正确的路径。但是,运行

sudo pecl install memcached
会抛出以下错误:

checking whether to use system FastLZ library... no
checking for ZLIB... yes, shared
checking for pkg-config... /opt/homebrew/bin/pkg-config
configure: error: Can't find ZLIB headers under "/opt/homebrew/opt/zlib/include"
ERROR: `/private/tmp/pear/temp/memcached/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config --with-libmemcached-dir=no --with-zlib-dir=/opt/homebrew/opt/zlib/include --with-system-fastlz=no --enable-memcached-igbinary=no --enable-memcached-msgpack=no --enable-memcached-json=no --enable-memcached-protocol=no --enable-memcached-sasl=no --enable-memcached-session=no' failed

我该如何解决这个问题?

php memcached zlib pecl php-memcached
1个回答
0
投票

我有同样的问题,并设法让它在 Mac 上使用路径工作:

/opt/homebrew/opt/zlib

不是“/opt/homebrew/opt/zlib/include”,尽管从技术上讲这是包含标题的文件夹,但错误消息具有误导性。

© www.soinside.com 2019 - 2024. All rights reserved.