First go to the official under the latest version of Memcached (memcached-1.4.22.tar.gz) and dependent package libevent (libevent-2.0.21-stable.tar.gz):
http://www.memcached.org/files/
http://libevent.org/
There are two more PHP expansion packs:
Http://pecl.php.net/package/memcache
Http://pecl.php.net/package/memcached
The latest version of my current edition is: Memcache-2.2.7.tgz and memcached-2.2.0.tgz
Because PHP memcached package to install first libmemcached download the following
Https://launchpad.net/libmemcached
Latest Package libmemcached-1.0.18.tar.gz
The above five packages are downloaded well uploaded to the VPS:
First compile Libevent:
TAR-ZXVF libevent-2.0.21-stable.tar.gz
CD libevent-2.0.21-stable.tar.gz
./configure--prefix=/usr/local
Make && make install
TAR-ZXVF memcached-1.4.22.tar.gz
CD memcached-1.4.22
./configure--with-libevent=/usr/local
Make && make install
#因为自定义了安装路径所以软链下lib
Ln-s/usr/local/lib/libevent*/usr/lib/
#制作启动服务
CD scripts
MV Memcached.sysv/etc/init.d/memcached
#记得vi下你的memcached目录
chmod 755/etc/init.d/memcached
Chkconfig--add memcached
Chkconfig--level 345 memcached on
Chkconfig--list memcached
To modify the service startup content, note the actual path, configuration parameters, and PID file path as shown in the following illustration:
Next, compile PHP's two extensions:
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--with-zlib-dir--enable-memcache
Make && make install
TAR-ZXVF libmemcached-1.0.18.tar.gz
CD libmemcached-1.0.18
./configure
Make && make install
TAR-ZXVF memcached-2.2.0.tgz
CD memcached-2.2.0
/usr/local/php/bin/phpize
./configure--with-php-config=/usr/local/php/bin/php-config
Make && make install
If it is done without errors, we can see the extended directory displayed by the terminal (note that it may not be the same as your directory)
Finally we edit php.ini to modify the Extension_dir directory and join Extension=memcache.so and extension=memcached.so
Reboot:
#memcached
Service memcached Start
#php
Service PHP-FPM Restart
PostScript: Verify that under memcached has not started successfully we can telnet 127.0.0.1 11211 re-enter stats look at the state