How to install memcached module for php@7.1 on MacOS High Sierra?

北城以北 提交于 2020-01-31 08:42:34

问题


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

I received the errors:

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

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


回答1:


  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

  1. Verify you installed the module php -m should show you memcached in the outputted list


来源:https://stackoverflow.com/questions/50601476/how-to-install-memcached-module-for-php7-1-on-macos-high-sierra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!