Memcached services are installed directly with Yum
[email protected] ~]# Yum install memcached
Then start the Memcache service and launch multiple instances
[Email protected] ~]#/usr/bin/memcached-d-m 512-p 11211-u memcached-c 1024
[Email protected] ~]#/usr/bin/memcached-d-m 512-p 11212-u memcached-c 1024
[Email protected] ~]#/usr/bin/memcached-d-m 512-p 11266-u memcached-c 1024
[Email protected] ~]# Ps-ef|grep memcached
Root 2228 32759 0 19:15 pts/2 00:00:00 grep--color memcached
495 2713 1 0 Jun12? 00:04:04/usr/bin/memcached-d-M 512-p 11211-u memcached-c 1024
495 2720 1 0 Jun12? 00:05:10/usr/bin/memcached-d-M 512-p 11212-u memcached-c 1024
495 2727 1 0 Jun12? 00:07:10/usr/bin/memcached-d-M 512-p 11266-u memcached-c 1024
View memcached version
[Email protected] ~]# memcached-h|head-1
Memcached 1.4.4
This 1.4.4 version of memcached is the caching service used by native programs.
---------------------------------------------------------------------------------
Since the PHP service was previously installed, you will need to manually add the memcached extension module later.
The PHP extension is installed using the 2.2.0 version of Memcached
1) First install the memcached library libmemcached
[Email protected] ~]# https://launchpadlibrarian.net/165454254/libmemcached-1.0.18.tar.gz
[Email protected] ~]# TAR-ZVXF libmemcached-1.0.18.tar.gz
[Email protected] ~]# CD libmemcached-1.0.18
[Email protected] libmemcached-1.0.18]#/configure--prefix=/usr/local/libmemcached--with-memcached
[[email protected] libmemcached-1.0.18]# make && make install
2) then install memcached
[Email protected] ~]# wget http://pecl.php.net/get/memcached-2.2.0.tgz
[Email protected] ~]# TAR-ZVXF memcached-2.2.0.tgz
[Email protected] ~]# CD memcached-2.2.0
[Email protected] memcached-2.2.0]#/usr/local/php5.6.26/bin/phpize #使用phpize命令生成一个configure文件
[Email protected] memcached-2.2.0]#/configure--with-php-config=/usr/local/php5.6.26/bin/php-config-- With-libmemcached-dir=/usr/local/libmemcached
[[email protected] memcached-2.2.0]# make && make install
When the installation is complete, a memcached.so file is generated that needs to be added to the php.ini configuration file.
After installing php5.6.26, know that the extension file path is stored in/usr/loca/php5.6.26/lib/php/extensions/no-debug-non-zts-20131226/
Then put the generated memcached.so file from the above compilation into the/usr/loca/php5.6.26/lib/php/extensions/no-debug-non-zts-20131226/
Compiling the php.ini file
[Email protected] ~]# Vim/usr/loca/php5.6.26/etc/php.ini
....
extension= "/usr/loca/php5.6.26/lib/php/extensions/no-debug-non-zts-20131226/memcached.so"
Then restart PHP
[Email protected] ~]# pkill-9 PHP-FPM
[Email protected] ~]#/USR/LOCA/PHP5.6.26/SBIN/PHP-FPM
Then look at the PHP extension module
[Email protected] etc]#/usr/loca/php5.6.26/bin/php-m
......
Memcached
Add php memcached Extension Module