软件下载官方
http://pecl.php.net/package/memcached
第一种:安装php-memcached扩展
1、安装libmemcached库
[root@test src]# wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
[root@test src]# tar xf libmemcached-1.0.18.tar.gz
[root@test src]# cd libmemcached-1.0.18
[root@test libmemcached-1.0.18]# ./configure --prefix=/usr/local/libmemcached && make && make install
2、安装php-fpm的memcached扩展
[root@test src]# wget http://pecl.php.net/get/memcached-2.2.0.tgz
--2017-12-28 09:25:13-- http://pecl.php.net/get/memcached-2.2.0.tgz
Resolving pecl.php.net... 104.236.228.160Connecting to pecl.php.net|104.236.228.160|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 75024 (73K) [application/octet-stream]
Saving to: “memcached-3.0.0.tgz”
100%[=====================================================================================================================================================>] 75,024 117K/s in 0.6s
2017-12-28 09:25:14 (117 KB/s) - “memcached-2.2.0.tgz” saved [75024/75024]
[root@test src]# tar xf memcached-2.2.0.tgz
[root@test src]# cd memcached-2.2.0
[root@test 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@test extensions]# cd /usr/local/src/memcached-2.2.0
[root@test memcached-2.2.0]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl && make && make install
Installing shared extensions: /usr/local/php-5.6.10/lib/php/extensions/no-debug-non-zts-20131226/
3、
接下来,我们编辑php配置文件php.ini,把 php-memcached 扩展加到配置文件。
在 php.ini 中添加以下内容:
1 extension=memcached.so
最后重启nginx和php-fpm