1.下载redis安装redis
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make && make install
如果错误为:undefined reference to `__sync_add_and_fetch_4'
在make操作的时候加一个执行参数:make CFLAGS="-march=i686"
2、编译完成后,在Src目录下,有四个可执行文件redis-server、redis-benchmark、redis-cli和redis.conf。然后拷贝到一个目录下
mkdir /usr/redis
cp redis-server /usr/redis
cp redis-benchmark /usr/redis
cp redis-cli /usr/redis
cp redis.conf /usr/redis
cd /usr/redis
3、启动Redis服务。
$ redis-server redis.conf
4、然后用客户端测试一下是否启动成功。
$ redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
5.下载php-redis扩展
https://github.com/owlient/phpredis/tarball/master
tar -zxvf owlient-phpredis-2.1.1-1-g90ecd17.tar.gz
cd owlient-phpredis-90ecd17
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
#执行完make install后会生成
#Installing shared extensions: /usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/
#修改php.ini
vi /usr/local/php/etc/php.ini
#查找extension_dir,修改为
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
#添加redis
extension = redis.so
#重启apache
service httpd restart