如何在MacOS High Sierra上为php@7.1安装memcached模块? [英] How to install memcached module for php@7.1 on MacOS High Sierra?
问题描述
我在为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.
推荐答案
-
pecl bundle memcached
- 更改为输出目录
-
phpize
- 确保已安装libmemcached和zlib(
brew install libmemcached zlib
) - 获取zlib目录(
brew list zlib
) -
./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/
(用上一个命令中的zlib路径替换zlib路径) -
make
-
make install
- 在您的php.ini文件中添加扩展行(例如,更改路径以匹配make install输出.我将其添加到我的
/usr/local/etc/php/7.4/conf.d
目录中名为ext-memcached.ini的文件中
pecl bundle memcached
- Change to the directory it output
phpize
- Make sure libmemcached and zlib are installed (
brew install libmemcached zlib
) - Get the zlib directory (
brew list zlib
) ./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/
(replace the zlib path with the one from the previous command)make
make install
- 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
- 验证您已安装模块
php -m
应该在输出列表中显示memcached
- Verify you installed the module
php -m
should show you memcached in the outputted list
这篇关于如何在MacOS High Sierra上为php@7.1安装memcached模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!