如何在MacOS High Sierra上为php@7.1安装memcached模块? [英] How to install memcached module for php@7.1 on MacOS High Sierra?

查看:142
本文介绍了如何在MacOS High Sierra上为php@7.1安装memcached模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为php 7.1安装memcached的模块时遇到问题.我使用自制软件安装MacOS High Sierra和php@7.1.在使用命令安装用于PHP的memcached模块期间

I have the issue installing a memcached's module for php 7.1. I use MacOS High Sierra and php@7.1 installing using homebrew. During the installation of memcached module for php using command

pecl install memcached

pecl install memcached

我收到了错误:

正在检查zlib位置...配置:错误:memcached支持 需要ZLIB.使用--with-zlib-dir =指定前缀,其中 ZLIB标头和库位于ERROR: `/private/tmp/pear/install/memcached/configure --with-php-config=/usr/local/opt/php@7.1/bin/php-config --with-libmemcached-dir'失败

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.在自制软件存储库中进行更改后,我找不到找到如何安装memcached模块的方法.

But I have installed zlib. I can't find a way how to install memcached module after the changes in homebrew repository.

推荐答案

  1. pecl bundle 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路径替换zlib路径)
  7. make
  8. make install
  9. 在您的php.ini文件中添加扩展行(例如,更改路径以匹配make install输出.我将其添加到我的/usr/local/etc/php/7.4/conf.d目录中名为ext-memcached.ini的文件中
  1. pecl bundle memcached
  2. Change to the directory it output
  3. phpize
  4. Make sure libmemcached and zlib are installed (brew install libmemcached zlib)
  5. Get the zlib directory (brew list zlib)
  6. ./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/ (replace the zlib path with the one from the previous command)
  7. make
  8. make install
  9. Add the extension line in your php.ini file (ex. change the paths to match what make install output. I added this to my /usr/local/etc/php/7.4/conf.d directory in a file called ext-memcached.ini

[memcached] extension=memcached.so

[memcached] extension=memcached.so

  1. 验证您已安装模块php -m应该在输出列表中显示memcached
  1. Verify you installed the module php -m should show you memcached in the outputted list

这篇关于如何在MacOS High Sierra上为php@7.1安装memcached模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆