Roman Kutenko
Roman Kutenko

Reputation: 27

How to install memcache extension (php72, macos Catalina)

I can't install memcache (not memcached) extension on MacOs Catalina, php 7.2

checking for the location of zlib... configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
ERROR: `/private/tmp/pear/temp/memcache/configure --with-php-config=/usr/local/opt/[email protected]/bin/php-config --enable-memcache-session=yes' failed

I try

pecl install memcache --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include/zlib.h

But

Attempting to discover channel "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include"...
Attempting fallback to https instead of http on channel "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include"...
unknown channel "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include" in "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include/zlib.h"
invalid package name/package file "--with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/include/zlib.h"

Upvotes: 1

Views: 2733

Answers (2)

Kamil Dziedzic
Kamil Dziedzic

Reputation: 5032

You can use env variable PHP_ZLIB_DIR to tell it where zlib is.

PHP_ZLIB_DIR=/usr/local/opt/zlib pecl install memcache

Upvotes: 4

afessler
afessler

Reputation: 1374

You're close... Your path should not to be the header file but to the directory. Also, pecl install doesn't pass the command line parameter in the script down to the ./configure command so you have to do it yourself:

pecl download memcache
open memcache-4.0.5.2.tgz  
cd memcache-4.0.5.2/memcache-4.0.5.2
phpize
./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11
make
sudo make install

Upvotes: 3

Related Questions