PHP connection memcached Cache server has two clients, one is memcache is the bottom of the development library, Memcached is a relatively new development library, PHP Install any one of these two extensions can be used in the writing of PHP code memcached cache data, to achieve the cache PHP execution results
1. Installation Memcache
TAR-ZXVF memcache-2.2.7.tgz
CD memcache-2.2.7
/usr/local/php/bin/phpize
./configure–with-php-config=/usr/local/php/bin/php-config
Make && make install
After the installation is successful, there are similar prompts
Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
In/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/this directory generates memcache.so
Edit PHP.ini Add the following
Extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcache.so
Restart PHP-FPM
To see if the Memcache module has been loaded
2. Installation memcached
since memcached is developed based on libmemcached, it is first installed libmemcached
Install libmemcached to install GCC44 gcc44-c++
Yum Install gcc*
Export cc= "GCC44"
Export cxx= "g++44"
TAR-ZXVF libmemcached-1.0.18.tar.gz
CD libmemcached-1.0.18
./configure–prefix=/usr/local/libmemcached
Make && make install
TAR-ZXVF memcached-2.2.0.tgz
CD memcached-2.2.0
/usr/local/php/bin
./configure–with-php-config=/usr/local/php/bin/php-config \
–with-libmemcached-dir=/usr/local/libmemcached/
Make && make install
There are hints similar to memcache after the installation is complete
Memcached.so will appear under the/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525 path
Edit PHP.ini Add the following
Extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcached
Reboot php-fpm to see if PHP supports memcached