1、编译Memcache (原生的Memcache 3.08版无法在PHP7下编译,故选用Github的pecl-memcache分支版本。) 代码: https://github.com/websupport-sk/pecl-memcache/archive/php7.zip # FTP上传 cd pecl-memcache export PHP_PREFIX="/usr/local" $PHP_PREFIX/php/bin/phpize ./configure --with-php-config=$PHP_PREFIX/php/bin/php-config make && make install 2、修改php.ini文件,加载Memcache组件。 代码: [memcache] extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/" extension = "memcache.so" 3、配置Memcached的步骤,首先安装Libevent事件触发管理器。 代码: https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz tar vxf libevent-2.1.8-stable.tar.gz cd libevent-2.1.8-stable ./configure -prefix=/usr/local/libevent # ./configure make && make install 或者 yum install libevent-devel # Centos可以直接运行安装。 5、编译Memcached 代码: wget http://memcached.org/files/memcached-1.4.34.tar.gz tar vxf memcached-1.4.34.tar.gz cd memcached-1.4.34 ./configure -with-libevent=/usr/local/libevent # ./configure make && make install