The best life is use of willing attitude, a happy-go-lucky life.
— Mr.Wang
发布时间:2018-04-28 16:50:26
发布作者:admin
3797
安装环境:CentOS 6.5
php的扩展memcache,不支持cas,所以我们要装memcached扩展,memcached扩展是基于libmemcached,所以要先安装libmemcached
一、下载软件
1、libmemcached下载地址:https://launchpad.net/libmemcached/+download
(https://launchpadlibrarian.net/165454254/libmemcached-1.0.18.tar.gz)
文件:libmemcached-1.0.18.tar.gz
2、php-memcached下载地址:http://pecl.php.net/package/memcached
(http://pecl.php.net/get/memcached-2.2.0.tgz)
文件:memcached-2.2.0.tgz
PHP7请下载:
git clone https://github.com/php-memcached-dev/php-memcached memcached
二、安装libmemcached
[root@localhost src]# tar zxvf libmemcached-1.0.18.tar.gz
[root@localhost src]# cd libmemcached-1.0.18
[root@localhost libmemcached-1.0.18]# ./configure --prefix=/usr/local/libmemcached --with-memcached
[root@localhost libmemcached-1.0.18]# make
[root@localhost libmemcached-1.0.18]# make install
三、安装php-memcached
[root@localhost src]# tar zxvf memcached-2.2.0.tgz
[root@localhost src]# cd memcached-2.2.0
[root@localhost memcached-2.2.0]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@localhost memcached-2.2.0]# ./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
[root@localhost memcached-2.2.0]# make
[root@localhost memcached-2.2.0]# make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
[root@localhost memcached-2.2.0]# ll /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
total 2140
-rwxr-xr-x. 1 root root 325608 Dec 30 15:59 memcached.so
-rwxr-xr-x. 1 root root 453766 Dec 30 17:44 memcache.so
-rwxr-xr-x. 1 root root 540834 Dec 19 15:38 opcache.so
-rwxr-xr-x. 1 root root 861055 Dec 30 16:47 redis.so
[root@localhost memcached-2.2.0]# vim /usr/local/php/lib/php.ini
加上extension=memcached.so
重启php
查看phpinfo可以看到支持了