Libmemcached is a memcached Library, client library, and client library implemented in C and C ++ languages. it has low memory usage, thread security, and provides comprehensive support for memcached functions.
Libmemcached is a memcached Library, client library, and client library implemented in C and C ++ languages. it has low memory usage, thread security, and provides comprehensive support for memcached functions.
PHP memcache client based on libmemcached has many advantages
Hash consistent storage
Multi get/set
The key is automatically hashed to int, avoiding the limit that the memcache key string is less than 255Byte by default.
I haven't configured the server for a long time. I always thought that libmemcached's php memcached has been included in the basic installation package. In the end, I still need to compile it myself. The entire installation process is a lot of dark holes and I tried it several times before it was successful.
Two steps for installation
Install libmemcached to the so and header files
Install memcachedphp extensions
Libmemcaced is divided into two major versions: 0. x and 1.x, 1. the version of x starts from, and compilation is very troublesome. it requires special configuration of gcc4.0 or above, and compile is extremely slow. 0. version x is much simpler. The maximum version is 0.53. Therefore, install version 0.53.
Php memcahed starts from 2.1.0, and libmemcached must be 1.0.x.
Libmemcaced I used 0.53, so php-memcahed chose 2.0.0. version maintenance of open-source software is a mess.
Install libmemcached
Wget https://launchpad.net/libmemcached/1.0/0.53/+download/libmemcached-0.53.tar.gz
Tar xvfz libmemcached-0.53.tar.gz
Cd libmemcached-0.53
./Configure -- prefix =/opt/libmemcached
Make & make install
Install php extension
Wget http://pecl.php.net/get/memcached-2.0.0.tgz
Tar zvxf memcached-2.0.0.tgz
Cd memcached-2.0.0/
./Configure -- enable-memcached -- with-php-config =/usr/local/php/bin/php-config -- with-libmemcached-dir =/opt/libmemcached/
Make & make install
Make install is to install memcached. so to $ {php install dir}/extensions/no-debug-non-zts-20090626/, which varies with the php version
In the last step, modify php. ini and add extension = memcached. so.