yum install memcached
yum install php-pecl-memcache
pecl install memcache
如果pecl安装失败,可以源码安装PHP的memcache扩展:
在http://pecl.php.net/package/memcache 选择相应想要下载的memcache版本。
tar -zxvf memcache-2.2.7.tgz
cd memcache-2.2.7
/usr/bin/phpize
./configure -enable-memcache -with-php-config=/usr/bin/php-config -with-zlib-dir #路径一定按自己服务器情况给,不然编出来的so不能用
make && make install
service memcached restart
添加Memcached开机启动
1. cd /etc/rc.d/init.d/
2. chmod 777 memcached
3. chkconfig --add memcached
4. chkconfig --level 235 memcached on
5. chkconfig --list | grep memcached
启动memcached: memcached –u nobody –d –m 256 –p 11211
1. 安装第三方软件库
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.5.2-2.rf.src.rpm
rpm -ivh rpmforge-release-0.5.2-2.rf.src.rpm
2. 查找Memcached
yum search memcached
3. 安装Memcached
yum -y install memcached
4. 验证安装
memcached -h
应该会输出一些帮助信息
5. 将memcache加入启动列表
chkconfig --level 2345 memcached on
6. 配置Memcache
vi /etc/sysconfig/memcached