I have the issue installing a memcached’s module for php 7.1. I use MacOS High Sierra and [email protected] 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/[email protected]/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.
3
Answers
pecl bundle memcached
phpize
brew install libmemcached 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)make
make install
/usr/local/etc/php/7.4/conf.d
directory in a file called ext-memcached.ini[memcached]
extension=memcached.so
php -m
should show you memcached in the outputted listYou can use env variable
PHP_ZLIB_DIR
to tell it where zlib is.Full installation.
To install memcached prerequisite
brew install pkg-config zlib
php -v
tells you which php version is active for cli.pecl config-get ext_dir
will tell you which version configuration files are set.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
examplezlib directory [no] : /opt/homebrew/Cellar/zlib/1.2.11
Restart your php and nginx/apache2
brew services restart [email protected]
brew services restart nginx
brew services restart apache2
You can check extension is installed or not by using
php -m
.Note : Am using
MacPro M1 silicon chip
notebook. Installed usinghomebrew
. struggle a lot to fix this issue.