Centos下扩展php的memcache模块脚本

#!/bin/bash

#安装memcache的支持libevent
yum -y install libevent

#验证
ls -al /usr/lib | grep libevent || echo "libevent install failed"

#下载安装php的memcache扩展
yum -y install gcc gcc-c++ autoconf 
cd /usr/local/src/;wget http://pecl.php.net/get/memcache-2.2.7.tgz 
tar zxf memcache-2.2.7.tgz
cd memcache-2.2.7
phpize
./configure
make && make install

echo "extension=memcache.so" >> /etc/php.ini

php验证脚本

connect('localhost', 11211) or die ("Could not connect"); 
    $memcache->set('key', 'test'); 
    $get_value = $memcache->get('key');
    echo $get_value;
?>
 

0 个评论

要回复文章请先登录注册