|||
1: 下载最新的稳定版redis
wget http://redis.googlecode.com/files/redis-2.6.7.tar.gz
2: 安装
tar xzf redis-2.6.7.tar.gz
cd redis-2.6.7
make
cp src/redis-server /usr/bin/ cp src/redis-cli /usr/bin/ cp src/redis-check-aof /usr/bin/ cp src/redis-check-dump /usr/bin/ cp src/redis-benchmark /usr/bin/
3: 编写redis配置文件
mkdir -p /etc/redis/
cp redis.conf /etc/redis/redis.conf
3: 启动
redis-server /etc/redis/redis.conf
4: 测试
redis-cli
redis 127.0.0.1:6379>set myKey myValue
OK
redis 127.0.0.1:6379> get myKey
"myValue"
5:安装phpredis
git clone https://github.com/nicolasff/phpredis.git
cd phpredis
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
vim /usr/local/webserver/php/etc/php.ini
找到类似:
extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20100525/"
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"
换行添加 extension = "redis.so"
6:重启web服务器
/usr/local/webserver/apache/bin/apachectl restart
<?php
phpinfo();
?>
Redis Support enabled
Redis Version 2.2.2
见到上面信息,说明已经ok
写个简单脚本测试一下
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('test','hello world!');
var_dump($redis->get('test'));
结果:
string(12) "hello world!"
ok!
7: 安装 phpRedisAdmin
git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
将phpRedisAdmin 移动到apache htdoc目录下
ps: github下的这个版本不完整, 最后在A5下载到了完整版
http://down.admin5.com/plus/download.php?open=0&aid=75024&cid=3
刚刚测试的几个变量, 在那边ok
前端缓存 开始尝试使用NO SQL 这个时髦的东西了.