PHP's Memcached extension uses the API provided by the Libmemcached library to interact with the Memcached server. It also provides a session processor (memcached).
PHP Memcached Extension Support Getmulti,setmulti methods, and Memcache extension is not supported;
When installing the Memcached extension, you need to install the libmemcached,libmemcached is Memcached C client, it has the advantage of low memory, line Cheng characteristics, in high concurrency, stability decisively improved.
First install libmemcached 1.0.18
Enter/USR/LOCAL/SRC, download the source package:
[Email protected] src]# wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
Extract:
[Email protected] src]# TAR-ZXVF libmemcached-1.0.18.tar.gz
Enter the unpacked folder:
[Email protected] libmemcached-1.0.18]# CD libmemcached-1.0.18
Configuration:
[Email protected] libmemcached-1.0.18]#/configure--prefix=/usr/local/libmemcached--with-memcached
Compile and install:
[[email protected] libmemcached-1.0.18]# make && make install
Installation of PHP Memcached 2.2.0 extensions
Go to/USR/LCOAL/SRC and download the extended source package:
[Email protected] src]# wget https://launchpad.net/libmemcached/+download/memcached-2.2.0.tgz
Extract:
Enter the extracted directory:
[Email protected] src]# CD memcached-2.2.0
Add extensions dynamically to PHP with Phpize:
[Email protected] memcached-2.2.0]#/usr/local/php/bin/phpize
Configuration:
[Email protected] memcached-2.2.0]#./configure --with-memcached-with-php-config=/usr/local/php/bin/ Php-config--with-libmemcached-dir=/usr/local/libmemcached--enable-memcached
If error:
Configure:error:no, Sasl.h is not available. Run Configure with--DISABLE-MEMCACHED-SASL to disable this check
Then the configuration should read:
[Email protected] memcached-2.2.0]#/configure --with-memcached-with-php-config=/usr/local/php/bin/ Php-config--with-libmemcached-dir=/usr/local/libmemcached--enable-memcached--DISABLE-MEMCACHED-SASL
Compile and install:
[[email protected] memcached-2.2.0]# make && make install
Installation Complete:
A memcached.so file is generated:
/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Open a. php.ini file and add a "extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/memcached.so"
Restart LNMP.
Visit Phpinfo:
Reference:
Installation of PHP memcached extensions
Linux-based libmemcached,php extended memcached installation
CentOS 6.6 Install PHP Memcached extension