linux下安装memcache以及开启memcache扩展

memcache 的工作就是在专门的机器的内存里维护一张巨大的hash表,来存储经常被读写的一些数组与文件,从而极大的提高网站的运行效率,减轻后端数据库的读写压力。
在安装memcached之前需要安装libevent支持:
1.安装memcache

或者使用wget 链接地址得到libevent与memcache
cd /home/blue tar zxvf memcached-1.4.5.tar.gz tar zxvf libevent-1.4.14b-stable.tar.gz #安装libevent cd libevent-1.4.14b-stable ./configure make make install #安装memcache cd /home/blue/memcached-1.4.5 ./configure --prefix=/usr/local/src/memcached/memcached-1.4.5 --with-libevent=/usr/local/src/memcached/libevent-1.4.14b make make install

2.配制memcache扩展

#wget http://pecl.php.net/get/memcache-2.2.6.tgz

# tar zxf memcache-2.2.6.tgz
# cd php/bin/phpize

# /usr/local/php/bin/phpize

# ./configure --with-php-config=/usr/local/php/bin/php-config  --enable=memcache
# make
# make install

最后将如下配置信息添加到php.ini文件中

extension_dir = "/usr/local/php/extensions/no-debug-non-zts-20060613/"
extension=memcache.so

重启apache

./apachectl restart

 
原文地址:https://www.cnblogs.com/bjfy/p/5430577.html