[Redis] Redis installation and testing under centos, rediscentos_PHP tutorial

WBOY
Release: 2016-07-12 08:54:00
Original
971 people have browsed it

[Redis] redis is installed and tested under centos, rediscentos

download the software, use the command wget xxx, parameters: url

For example:

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

To decompress, use the command tar, parameters: zxvf z (gzip attribute), x (decompression), v (display process), f (use file name), file name

For example:

tar zxvf redis-3.0.0.tar.gz

Switch to the unzipped directory and install

cd redis-3.0.0

make

The installation is now complete. Go to the directory src and start redis

redis-server

Open the client, test, or in the src directory, start the client

redis-cli

Enter the redis control panel and use the command set get to test

set name taoshihan

get name

To access external network, first temporarily close the firewall or open port 6379 of the firewall

Turn off the firewall: service iptables stop

Modify firewall rules: edit /etc/sysconfig/iptables file

You can copy the configuration of other ports and change it, add a line -A INPUT -p tcp -m tcp --dport 6379 -j ACCEPT

php test

Download php extension file for windows system

Download address: http://windows.php.net/downloads/pecl/releases/redis/2.2.7/php_redis-2.2.7-5.6-ts-vc11-x64.zip

Put php_redis.dll in the ext directory and modify php.ini

Add 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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1122385.htmlTechArticle[Redis] Redis is installed and tested under centos. To download the software in rediscentos, use the command wget xxx, parameter: url. For example: wget http://download.redis.io/releases/redis-3.0.0.tar.gz decompress,...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template