Mac installation memcached
MAC installation memcached installation environment
Mac OSX 10.9.5 Mavericks
PHP5.4
Using homebrew
installation process
First use Brew to find the relevant software to install
Brew Install memcached
Structure for
libmemcached php53-memcached php55-memcachedmemcached php54-memcached php56-memcached
And then click Install
Brew Install memcached Brew install Php54-memcachedbrew install libmemcached
The libmemcached installed here is 1.0.18 Version, 1.0.17 version seems incompatible with Mac OSX 10.9
The version of libmemcached in the current brew can be viewed through VIM/USR/LOCAL/LIBRARY/FORMULA/LIBMEMCACHED.RB
Finally added in the php.ini
Extension=memcached.so
Start the memcached command
memcached-d default parameter start
Memcached-d-M 1024-l 127.0.0.1-p 11211
Start parameter Description:
The-D option is to start a daemon,
-M is the amount of memory allocated to Memcache, in megabytes, default 64MB
-M return error on memory exhausted (rather than removing items)
-U is the user running memcache, and if it is currently root, you need to specify the user with this parameter.
-L is the server IP address of the listener, which defaults to all network cards.
-P is the port that sets the TCP listener for memcache, preferably a port above 1024
The-c option is the maximum number of concurrent connections that are running, by default 1024
-P is a PID file that is set to save Memcache
-F
Chunk size growth factor (default:1.25)
-I Override the size of each slab page. Adjusts max item size (new 1.4.2 version) can also start multiple daemons, but ports cannot be duplicated
Test program
<?php $mem = new Memcached (), $news _content = "news content"; $mem->addserver ("127.0.0.1", 11211); $get _news = $mem-& Gt;get ("news_123"), if ($get _news) {echo "cache content". $get _news;} else{$mem->set ("news_123", $news _content, 10); echo "Original content". $news _content;}? >
Mac OSX 10.9.5, PHP5.4 installation memcached