php - 如何在 MacOS High Sierra 上为 php@7.1 安装 memcached 模块?

标签 php macos memcached macos-high-sierra

我在为 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 模块的方法。

最佳答案

  1. pecl 捆绑 memcached
  2. 切换到它输出的目录
  3. phpize
  4. 确保安装了 libmemcached 和 zlib(brew install libmemcached zlib)
  5. 获取zlib目录(brew list zlib)
  6. ./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/(将 zlib 路径替换为上一个命令中的路径)
  7. 制作
  8. 安装
  9. 在您的 php.ini 文件中添加扩展行(例如,更改路径以匹配 make install 的输出。我将其添加到我的 /usr/local/etc/php/7.4/conf.d 目录中名为 ext-memcached.ini 的文件

[内存缓存] 扩展=memcached.so

  1. 确认您安装了模块 php -m 应该会在输出列表中显示 memcached

关于php - 如何在 MacOS High Sierra 上为 php@7.1 安装 memcached 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50601476/

相关文章:

php - 使用 Idiorm/Paris 查询 MySQL 表

macos - RubyMotion 中的指针与 MacRuby 中的指针

javascript - cmd+s 和 ctrl+s 的 jquery 按键事件

php - 在 PHP 中使用带有动态变量名称的大括号

PHP根据输入字段中给定的数字显示多个星号

bash - Docker osx挂载文件夹为空

php - 如何使用 PHP 将数据存储在 RAM 内存中?

java - 使用 hibernate/jpa/memcache 缓存大数据集?

php - 使用 PECL 安装扩展是否会警告我它将进行的任何更改?

php - 从 mysql schemata 的版本控制开始,不要矫枉过正。好的解决方案?