我在为 php 7.1 安装 memcached 模块时遇到问题。我使用 MacOS High Sierra 和 php@7.1 使用自制软件安装。在使用命令为 php 安装 memcached 模块期间
pecl install memcached
我收到错误:
checking for zlib location... configure: error: memcached support requires ZLIB. Use --with-zlib-dir= to specify the prefix where ZLIB headers and library are located ERROR: `/private/tmp/pear/install/memcached/configure --with-php-config=/usr/local/opt/php@7.1/bin/php-config --with-libmemcached-dir' failed
但是我已经安装了 zlib。在 homebrew 存储库发生更改后,我找不到如何安装 memcached 模块的方法。
最佳答案
pecl 捆绑 memcached
- 切换到它输出的目录
phpize
- 确保安装了 libmemcached 和 zlib(
brew install libmemcached zlib
) - 获取zlib目录(
brew list zlib
) ./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/
(将 zlib 路径替换为上一个命令中的路径)制作
安装
- 在您的 php.ini 文件中添加扩展行(例如,更改路径以匹配 make install 的输出。我将其添加到我的
/usr/local/etc/php/7.4/conf.d
目录中名为 ext-memcached.ini 的文件
[内存缓存]
扩展=memcached.so
- 确认您安装了模块
php -m
应该会在输出列表中显示 memcached
关于php - 如何在 MacOS High Sierra 上为 php@7.1 安装 memcached 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50601476/