[英]How to install memcached module for php@7.1 on MacOS High Sierra?
I have the issue installing a memcached's module for php 7.1.我在为 php 7.1 安装 memcached 模块时遇到问题。 I use MacOS High Sierra and php@7.1 installing using homebrew.我使用 MacOS High Sierra 和 php@7.1 使用自制软件安装。 During the installation of memcached module for php using command在使用命令为 php 安装 memcached 模块期间
pecl install memcached pecl 安装 memcached
I received the errors:我收到错误:
checking for zlib location... configure: error: memcached support requires ZLIB.检查 zlib 位置...配置:错误:memcached 支持需要 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使用 --with-zlib-dir= 指定 ZLIB 头文件和库所在的前缀错误:`/private/tmp/pear/install/memcached/configure --with-php-config=/usr/local/opt/ php@7.1/bin/php-config --with-libmemcached-dir' 失败
But I have installed zlib.但是我已经安装了 zlib。 I can't find a way how to install memcached module after the changes in homebrew repository.在自制软件存储库中发生更改后,我找不到如何安装 memcached 模块的方法。
pecl bundle memcached
phpize
brew install libmemcached zlib
)确保安装了 libmemcached 和 zlib( brew install libmemcached zlib
)brew list zlib
)获取 zlib 目录( 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) ./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/
(用上一个命令中的路径替换zlib路径)make
make install
/usr/local/etc/php/7.4/conf.d
directory in a file called ext-memcached.ini在 php.ini 文件中添加扩展行(例如,更改路径以匹配 make install 输出的内容。我将此添加到我的/usr/local/etc/php/7.4/conf.d
目录中名为 ext-memcached 的文件中.ini [memcached] extension=memcached.so
php -m
should show you memcached in the outputted list验证您安装了模块php -m
应该在输出列表中显示 memcachedYou can use env variable PHP_ZLIB_DIR
to tell it where zlib is.您可以使用环境变量PHP_ZLIB_DIR
来告诉它 zlib 在哪里。
PHP_ZLIB_DIR=/usr/local/opt/zlib pecl install memcached
Full installation.完整安装。
brew install zlib
yes no | PHP_ZLIB_DIR=$(brew --prefix zlib) pecl install memcached
To install memcached prerequisite安装 memcached 先决条件
brew install pkg-config zlib
使用brew install pkg-config zlib
php -v
tells you which php version is active for cli. php -v
告诉您哪个 php 版本对于 cli 处于活动状态。pecl config-get ext_dir
will tell you which version configuration files are set. pecl config-get ext_dir
会告诉你设置了哪个版本的配置文件。brew list zlib
Install using sudo pecl install memcached
While installing it will ask zlib directory [no] :
in that paste zlib configuration path /opt/homebrew/Cellar/zlib/1.2.11
example zlib directory [no] : /opt/homebrew/Cellar/zlib/1.2.11
获取安装brew list zlib
所需的 zlib 配置路径 使用sudo pecl install memcached
安装 安装时会询问zlib directory [no] :
在该粘贴 zlib 配置路径/opt/homebrew/Cellar/zlib/1.2.11
示例zlib directory [no] : /opt/homebrew/Cellar/zlib/1.2.11
Restart your php and nginx/apache2 brew services restart php@7.2
brew services restart nginx
brew services restart apache2
重启你的 php 和 nginx/apache2 brew services restart php@7.2
brew services restart nginx
brew services restart apache2
You can check extension is installed or not by using php -m
.您可以使用php -m
来检查扩展是否安装。
Note : Am using MacPro M1 silicon chip
notebook.注意:我使用的是MacPro M1 silicon chip
笔记本。 Installed using homebrew
.使用homebrew
安装。 struggle a lot to fix this issue.努力解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.