Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlexanderMatveev/46166ef51cc58679ebeab6890451901b to your computer and use it in GitHub Desktop.
Save AlexanderMatveev/46166ef51cc58679ebeab6890451901b to your computer and use it in GitHub Desktop.
Install memcached & memcache on php 7.4 macOS M1

Install memcached & memcache on php 7.4 macOS M1

1) Install memcached

brew install libmemcached
brew install zlib

Find installed locations:

brew --cellar
#/opt/homebrew/Cellar
ls /opt/homebrew/Cellar/libmemcached/
#1.0.18_2
ls /opt/homebrew/Cellar/zlib/
#1.2.12

Install memcached using pecl:

pecl install memcached
#libmemcached directory [no] : /opt/homebrew/Cellar/libmemcached/1.0.18_2/
#zlib directory [no] : /opt/homebrew/Cellar/zlib/1.2.12
#use system fastlz [no] :
#enable igbinary serializer [no] :
#enable msgpack serializer [no] :
#enable json serializer [no] :
#enable server protocol [no] :
#enable sasl [yes] :
#enable sessions [yes] :

2) Install memcache

pecl download memcache-4.0.5.2
cd memcache-4.0.5.2/memcache-4.0.5.2/
phpize
./configure --with-zlib-dir=/opt/homebrew/Cellar/zlib/1.2.12/
make
make test
sudo make install
nano /opt/homebrew/etc/php/7.4/php.ini
# add extension="memcache.so"
php -m | grep memca
#memcache
#memcached

Done.

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