首先在memcached官网memcached.org下载memcached
根目录使用./configure --prefix=/var/local/lnmp/memcached安装
发现configure: error: libevent is required.,使用yum安装libevent
yum -y libevent libevent-devel
然后在再次使用./configure --prefix=/var/local/lnmp/memcached安装
make
make install 安装memcached成功
./memcached -d -m 512 -u root -p 11211 -c 1024
-d后台使用,-m 分配内存单位M -u运行memcached的用户,-p 启动端口,-c并发数
在libmemcached官网libmemcached.org下载libmemcached
根目录使用./configure --prefix=/var/local/lnmp/libmemcached安装
make
make install 安装libmemcached成功
到github.com下载php7.0的memcached扩展包
解压后根目录下执行/var/local/lnmp/php-7.0/bin/phpize安装
./configure --with-php-config=/var/local/lnmp/php-7.0/bin/php-config --with-libmemcached-dir=/var/local/lnmp/libmemcached-1.0/ --disable-memcached-sasl
make
make install 安装php7.0-memcached扩展成功
vim /var/local/lnmp/php-7.0/lib/php.ini
搜索extension
在下边添加
extension=memcached.so
lnmp重启php-fpm,lamp重启apache
扩展添加到此结束