CentOS使用Memcached加速WordPress
之前安装好了Memcached,现在就让它来发挥作用吧,使其加速WordPress!
首先安装依赖组件:
yum install cyrus-sasl-devel autoconf
然后编译安装libmemcached:
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar zxf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure --prefix=/usr/local/libmemcached && make && make install
安装php-memcached,生成memcached.so:
wget https://github.com/php-memcached-dev/php-memcached/archive/master.zip
unzip master.zip
cd php-memcached-master
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir=/usr/local/zlib --with-libmemcached-dir=/usr/local/libmemcached && make && make install
编辑php.ini,在里面加上:
extension=memcached.so
最后下载WordPress的Memcached插件:
https://github.com/tollmanz/wordpress-pecl-memcached-object-cache/archive/master.zip
解压缩后,编辑里面的object-cache.php文件,将里面Memcached的地址和端口改成你的,再放到WordPress的wp-content目录里即可!