Install redis, php-redis, and centosredis in centos in Linux.

Source: Internet
Author: User
Tags install redis

Install redis, php-redis, and centosredis in centos in Linux.

Source Address: http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm // This is centos 6

Install and enter the following command:

Step 1:

# Wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm# rpm-ivh epel-release-6-8.noarch.rpm # yum install redis php-redis #/etc/init. d/redis start // redis started successfully

Step 2:

# Vim/etc/sysconfig/iptables // configure the firewall #-a input-p tcp-m tcp -- dport 6379-j ACCEPT // Add this line in iptables, open Port 6379 (6379 is the default port of redis) # service iptables restart // restart the service

Step 3:

# Vim/etc/redis. conf // open the redis configuration file # bind 127.0.0.1 // note, that is, add # Number --- accessible from the Internet # service redis restart // restart the service

Step 4:

# Cd/usr/lib64/php/modules/# echo 'extension = redis. so '>/etc/php. d/redis. ini // introduce redis. so # vim/etc/php. d/redis. ini // remove the single quotation marks (that is, remove the comment) # service httpd restart // restart Apache

Test:

# Redis-cli redis 127.0.0.1: 6379> set a "Hello" // value: OK redis 127.0.0.1: 6379> get a "Hello" // Value
Php code:
<?php$redis = new Redis();$redis->connect('127.0.0.1',6379);$redis->set('a','Hello');echo $redis->get('a');?>

Ps: Windows

Cmd: https://github.com/dmajkic/redis/downloads

Service Installation Package: https://github.com/rgl/redis/downloads

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.