2019独角兽企业重金招聘Python工程师标准>>>
//编译安装服务器端
wget http://download.redis.io/releases/redis-2.8.0-rc3.tar.gz
tar zxvf redis-2.2.8.tar.gz
sudo mv redis-2.2.8 /usr/local/redis
cd /usr/local/redis
sudo make
sudo make install//编辑配置文件
daemonize yes
timeout 300//启动redis
redis-server /usr/local/redis/redis.conf
//在服务器端测试
redis-cli set test abc
redis-cli get test//关闭redis
redis-cli shutdown//安装php redis扩展
git clone https://github.com/nicolasff/phpredis.git
cd phpredis
sudo /usr/local/php/bin/phpize
sudo ./configure --with-php-config=/usr/local/php/bin/php-config
sudo make
sudo make install//编辑php.ini
vim /usr/local/php/etc/php.ini
extension= /usr/local/php/lib/php/extensions/debug-non-zts-20100525/redis.so//php中使用
$redis = new Redis();
$redis->connect('127.0.0.1', '6379');
$redis->set('test', 'abc');
echo $redis->get('test');