5

我正在尝试pecl install memcache在 OS X Yosemite 上使用 XAMPP 执行,但找不到zlib,产生此错误:

检查 ZLIB 的位置...不
检查 zlib 的位置...配置:错误:memcache 支持需要 ZLIB。

使用 --with-zlib-dir= 指定 ZLIB 包含和库所在的前缀

错误:`/private/tmp/pear/temp/memcache/configure --enable-memcache-session=yes' failed

如何安装zlib才能pecl install memcache成功?

4

2 回答 2

7
brew install zlib

如果您还没有这样做

接下来找到 zlib 头文件:

locate zlib.h

您可能会发现有几个选项可供选择。

/Applications/Xcode.app/Contents/Developer/Platforms/ etc

或者

/usr/local/Cellar/zlib/1.2.8/include/zlib.h

我尽可能使用 brew ,所以我选择了 brew 版本:

brew install php55-memcached --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8/include/zlib.h

我假设将此标志传递给 pecl 将具有相同的结果。

于 2015-07-21T03:35:31.940 回答
1

我对另一个扩展( SPX)有同样的问题

checking for zlib header... checking for zlib location... configure: error: spx support requires ZLIB. Use --with-zlib-dir=<DIR> to specify the prefix where ZLIB headers and library are located

./configure我在使用--with-zlib-dir标志运行时确实修复了它。确保您安装了 zlib ( brew install zlib)。

phpize
# ./configure
./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11
make
sudo make install
于 2021-06-16T12:18:35.460 回答