I have installed PHP, zlib and memcached using Homebrew on a Mac with Apple silicon. I am trying to install the memcached extension for PHP using
sudo pecl install memcached
When it prompts me for zlib directory [no] :
I specified "/opt/homebrew/opt/zlib/include"
I have confirmed that this directory contains the files zlib.h and zconf.h. brew info zlib
also tells me
For compilers to find zlib you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib"
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include"
For pkg-config to find zlib you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig"
So I seem to be supplying the correct path for zlib. However, running sudo pecl install memcached
is throwing the following error:
checking whether to use system FastLZ library... no
checking for ZLIB... yes, shared
checking for pkg-config... /opt/homebrew/bin/pkg-config
configure: error: Can't find ZLIB headers under "/opt/homebrew/opt/zlib/include"
ERROR: `/private/tmp/pear/temp/memcached/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config --with-libmemcached-dir=no --with-zlib-dir=/opt/homebrew/opt/zlib/include --with-system-fastlz=no --enable-memcached-igbinary=no --enable-memcached-msgpack=no --enable-memcached-json=no --enable-memcached-protocol=no --enable-memcached-sasl=no --enable-memcached-session=no' failed
How do I fix this?