问题描述
最近,我一直在尝试在安装了 pecl memcache
的 OSX Catalina 上安装 brew memcached
PHP 扩展,每次尝试安装过程时都会收到以下错误:
configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
我已尝试使用 pecl install memcache
和 pecl install --configureoptions='with-zlib-dir="path"' memcache
均无济于事。它总是得到相同的点,但失败了。
根据我对有关安装包的不同主题的评论,问题似乎与 -D
命令中的 pecl install
选项有关,因为当我从源代码进行手动安装时将参数 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11
传递给 ./configure
命令,它的作用就像一个魅力并安装软件包,但现在未列在 pecl list
已安装的软件包中,因此无法卸载。
问题是我需要 pecl
来管理软件包的安装,以便在环境从项目变为保护时能够随时卸载它。
解决方法
对此的快速修复(通过 https://bugs.php.net/bug.php?id=56522 找到)是使用 PHP_ZLIB_DIR 变量而不是 --with-zlib-dir。
即PHP_ZLIB_DIR=/usr/local/Cellar/zlib/1.2.11 pecl install memcache
我之前也遇到过 -D 选项的问题 - 几乎我可以说它完全坏了。