yum update
yum install memcached
yum install gcc libevent libevent-devel
yum install libmemcached-devel
(debian)
sudo apt-get install memcached
sudo apt-get install libevent-dev
cd /usr/local/src
wget
https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar xvzf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure
make
make install
### 可选 pecl 直接安装
pecl install memcached
chkconfig memcached on
### 编译安装(记得切php的版本)
(git clone https://github.com/php-memcached-dev/php-memcached/tree/php7)
git clone https://github.com/php-memcached-dev/php-memcached.git
进入memcache文件夹中,用命令行'phpize ',生成了configure等文件
(libmemcached目录一定要对,找不到就find全局搜下memcached.h)
./configure --with-php-config=/usr/bin/php-config --with-libmemcached-dir=/usr/lib/libmemcache --disable-memcached-sasl
make &&make install
装好后 改php.ini
添加扩展
extension=memcached.so
php-fpm 重启
php -m 检查是否装上