首页 > 代码库 > 安装phpredis扩展以及phpRedisAdmin工具

安装phpredis扩展以及phpRedisAdmin工具

先从phpredis的git拿到最新的源码包:
wget https://github.com/nicolasff/phpredis/archive/master.tar.gz
 
然后解压到进入目录:
tar xvf master.tar.gz
cd phpredis-master
 
编译,安装扩展:
phpize
./configure --enable-redis
make && make install
 
然后编辑php.ini加入 Extensions=redis.so
重启服务器发现php提示缺少redis.so,按照提示的目录把redis.so 拷贝过去就OK了.

phpRedisAdmin是一个在线管理redis的web工具,基于PHP完成.
安装也非常简单,进入web目录
git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
cd phpRedisAdmin/
cat README.markdown
git submodule init
git submodule update
 
然后就可以通过网址访问了.看一下config.inc.php的简单配置
‘servers‘ => array(
                        0 => array(
                                ‘name‘ => ‘local server‘, // Optional name.
                                ‘host‘ => ‘127.0.0.1‘,
                                ‘port‘ => 6379,
                                ‘filter‘ => ‘*‘

                                // Optional Redis authentication.
                                ),
 
这里是一些简单的redis服务配置.
phpRedisAdmin默认是可以匿名登录的.如果要设置 需要在config里加上
‘login‘ => array(
                                        // Username => Password
                                        // Multiple combinations can be used
                                        ‘admin‘ => array(
                                                ‘password‘ => ‘adminpassword‘,
                                                ),
                                        ‘guest‘ => array(
                                                ‘password‘ => ‘‘,
                                                ‘servers‘ => array(1) // Optional list of servers this user can access.
                                                )
                                        ),

 

下载predis(redis客户端: Predis、phpredis、Rediska、Redisent、iRedis,这里我用的是predis,只要放在phpredisadmin下面即可):https://github.com/nrk/predis/downloads

 

[root@localhost ~]# mv predis/* /usr/local/apache2/htdocs/phpredisadmin/predis/

 

安装phpredis扩展以及phpRedisAdmin工具