我已经在使用苹果芯片的Mac上使用Homebrew安装了PHP、zlib和memcached。我正在尝试使用以下命令安装PHP的memcached扩展:
sudo pecl install memcached
当它提示我输入“zlib目录[否]:”时,我指定了“/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
我该如何修复这个问题?