Home > php教程 > php手册 > [Redis] redis在centos下安装测试,rediscentos

[Redis] redis在centos下安装测试,rediscentos

WBOY
Release: 2016-06-13 08:41:27
Original
1612 people have browsed it

[Redis] redis在centos下安装测试,rediscentos

下载软件,使用命令wget xxx,参数:url

例如:

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

 

解压缩,使用命令tar,参数:zxvf  z(gzip属性的)、x(解压)、v(显示过程)、f(使用档案名称),文件名

例如:

tar zxvf redis-3.0.0.tar.gz

 

切换到解压目录里,进行安装

cd redis-3.0.0

make

 

此时就安装完成了,进到目录src里面,启动redis

redis-server

 

打开客户端,进行测试,还是src目录,启动客户端

redis-cli

进入了redis控制面板,使用命令set get测试

set name taoshihan

get name

 

运行外网访问,先暂时关闭防火墙或者,或开放防火墙的6379端口

关闭防火墙:service iptables stop

修改防火墙规则:编辑/etc/sysconfig/ iptables 文件

可以复制其他端口的配置改一下,添加一行 -A INPUT -p tcp -m tcp --dport 6379 -j ACCEPT

 

php测试

windows系统下载php扩展文件

下载地址:http://windows.php.net/downloads/pecl/releases/redis/2.2.7/php_redis-2.2.7-5.6-ts-vc11-x64.zip

把php_redis.dll放到 ext目录下,修改一下php.ini

添加extension=php_redis.dll

<?<span>php
</span><span>//</span><span> 连接到redis</span>
<span>$redis</span>=<span>new</span><span> Redis();
</span><span>$redis</span>->connect('192.168.1.113', 6379<span>);
</span><span>$redis</span>->set("name","小雪狼"<span>);
</span><span>echo</span> <span>$redis</span>->get("name"<span>);
</span>?>
Copy after login

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template