如何安装Memcache扩展程序(PHP72,MacOS Catalina)

时间:2020-01-17 09:33:38

标签: macos memcached php-7.2 macos-catalina

我无法在MacOs Catalina php 7.2上安装memcache(不是memcached)扩展

checking for the location of zlib... configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
ERROR: `/private/tmp/pear/temp/memcache/configure --with-php-config=/usr/local/opt/php@7.2/bin/php-config --enable-memcache-session=yes' failed

我尝试

pecl install memcache --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include/zlib.h

但是

Attempting to discover channel "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include"...
Attempting fallback to https instead of http on channel "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include"...
unknown channel "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include" in "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include/zlib.h"
invalid package name/package file "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include/zlib.h"

2 个答案:

答案 0 :(得分:1)

您要关闭...您的路径不应是头文件,而应是目录。另外,pecl install不会将脚本中的命令行参数传递给./configure命令,因此您必须自己做:

pecl download memcache
open memcache-4.0.5.2.tgz  
cd memcache-4.0.5.2/memcache-4.0.5.2
phpize
./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11
make
sudo make install

答案 1 :(得分:0)

您可以使用环境变量 PHP_ZLIB_DIR 来告诉它 zlib 的位置。

PHP_ZLIB_DIR=/usr/local/opt/zlib pecl install memcache