Skip to content

Instantly share code, notes, and snippets.

@Niteshvgupta
Last active March 1, 2023 02:15
Show Gist options
  • Save Niteshvgupta/1832ce29dee460b64d5384e4f585e7ab to your computer and use it in GitHub Desktop.
Save Niteshvgupta/1832ce29dee460b64d5384e4f585e7ab to your computer and use it in GitHub Desktop.
Install PHP7-compatible memcache on Mac OS X

1. Install PHP7 with brew

brew install php70

2. Install Memcache from source on PHP7 branch

git clone -b NON_BLOCKING_IO_php7 https://github.com/websupport-sk/pecl-memcache.git
cd pecl-memcache
phpize
./configure
make && make install

3. Add the Memcache extension to the php.ini for PHP7

vi /usr/local/etc/php/7.0/php.ini

Add extension=memcache.so under the extensions section.

@Jekins
Copy link

Jekins commented Jan 13, 2020

php 7.2
make: *** No targets specified and no makefile found. Stop.
Help plz

@muhaimincs
Copy link

is there any solid steps for PHP 7.3

@travisdetert
Copy link

Why does installing this seem to break with every single php release on MacOS? I've had to update this nearly every time.

@adampatterson
Copy link

adampatterson commented Feb 16, 2021

I am on macOS 11.1

If you get the following after running phpize:

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

Then run brew install autoconf from this Stack Overflow post

I then got an error:

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

So I ran brew install zlib which at first did not fix the error.

I ran the command with the zlib path ./configure --with-zlib-dir=/usr/local/opt/zlib

@NewZeal
Copy link

NewZeal commented Apr 1, 2022

For those getting make: *** No targets specified and no makefile found. Stop. Check that zlib was present when running ./configure. If not then the second answer here works: https://stackoverflow.com/questions/29726890/pecl-install-memcache-fails-on-os-x-yosemite-with-memcache-support-requires-zli

Follow the instructions for installing zlib and run ./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11 making sure you have the same version of zlib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment