龚哥哥 - 山里男儿 爱生活、做自己!
win安装PHP的Redis扩展
发表于 2015-8-31 | 浏览(5276) | 服务器

在win下安装php的redis扩展非常的简单,下载一个.dll扩展包放到php的ext目录下,在php.ini里边添加一行配置就可以了。

下载扩展包:

下载地址:https://github.com/nicolasff/phpredis/downloads

安装扩展包

解压后把dll放到php的ext目录下,打开php.ini 添加
extension=php_igbinary.dll
extension=php_redis.dll

检测是否安装成功,可以打开phpinfo看下
安装成功后,php测试

安装完成,进行测试

vim redis_test.php
<?php
  $r = new Redis();
  $r->connect('127.0.0.1', 6379);
  $r->set('devil', 'Hello World!', 10);
  echo $r->get('devil');
?>

阅读全文

CentOS安装PHP的Redis扩展
发表于 2015-8-31 | 浏览(5189) | 服务器

1;下载扩展包

wget https://github.com/nicolasff/phpredis/archive/master.zip

360云盘下载地址:

http://yunpan.cn/ccXwiNS2B5Hpi  访问密码 2970

2;解压扩展压缩包

unzip master.zip

3;进入安装包

cd phpredis-master

4;安装php-devel,fastcgi模式,phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块

yum install php-devel

5;编译安装

phpize
./configure
make
make install

6;修改php.ini

vim /etc/php.ini 添加 extension=redis.so

阅读全文

CentOS安装Redis服务
发表于 2015-8-31 | 浏览(5670) | 服务器

1;下载安装包

官网地址:http://www.redis.io/download

下载地址:http://download.redis.io/releases/redis-3.0.3.tar.gz

wget http://download.redis.io/releases/redis-3.0.3.tar.gz

2;解压

tar -zxvf redis-3.0.3.tar.gz
cd redis-3.0.3

3;编译

make
make && install

4;创建开机启动

vim /etc/init.d/redis-start 保存
/data/soft/redis-3.0.3/src/redis-server &

vim /etc/init.d/redis-stop 保存
/data/soft/redis-3.0.3/src/redis-cli shutdown

vim /etc/init.d/redis-cli 保存
/data/soft/redis-3.0.3/src/redis-cli
chmod 755 /etc/init.d/redis-*
echo "/etc/init.d/redis-start" >> /ect/rc.local

阅读全文

Redis同一台服务器开启不同工作空间
发表于 2015-8-30 | 浏览(7280) | 服务器

1;拷贝redis.conf配置文件

redis6379.conf
pidfile /var/run/redis6380.pid
port 6380

redis6380.conf
pidfile /var/run/redis6380.pid
port 6380

2;启动redis同时加载配置文件

redis-server redis6379.conf &
redis-server redis6380.conf &

3;php测试

<?php

    /**
     * redis测试
     */

    $redis = new Redis();
    $redis->connect('127.0.0.1', 6379);
    $redis->set('devil', 'hello world!');
    echo $redis->get('devil');

    echo '<br />---------------------<br />';

    $redis2 = new Redis();
    $redis2->connect('127.0.0.1', 6380);
    $redis2->set('devil', 'gongfuxiang');
    echo $redis2->get('devil');

    echo '<br />---------------------<br />';

    echo $redis->get('devil');

    // 输出
    hello world!
    ---------------------
    gongfuxiang
    ---------------------
    hello world!

?>

阅读全文

TOP