How to install the PHP extension pack for Redis

Source: Internet
Author: User
Tags phpinfo redis version

How to install the PHP extension pack for Redis Extensions: IGBINARY:HTTP://WINDOWS.PHP.NET/DOWNLOADS/PECL/RELEASES/IGBINARY/1.1.1/ memcache:http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/ redis:http://windows.php.net/downloads/pecl/snaps/redis/2.2.5/

try Redis Installation, PHP environment connection, test  

Redis Introduction

Redis essentially a key/value database, similar to the memcached NoSQL database, but his data can be persisted on the disk, solve the service restart data is not lost, his value can be string (string), list, Sets (collection) or ordered sets (the sorted collection), all data types have Push/pop, Add/remove, perform service-side aggregation, intersection, two sets sets of differences, and so on, these operations are atomic, Redis also supports a variety of sorting capabilities

Redis 2.0 many new features have been added, such as improved performance, new data types, and less memory (AOF and VMS)

Redis support for most mainstream development languages such as: C, Java, C #, PHP, Perl, Python, Lua, Erlang, Ruby, etc.

official website:http://code.google.com/p/redis/

1. Installation process

Latest stable version, Redis 2.0.4 stable

wget http://redis.googlecode.com/files/redis-2.0.4.tar.gz

Tar zxf redis-2.0.4.tar.gz

CD redis-2.0.4

Unlike other software, configure is not required.

Make

It's finished.

Create a Directory

Mkdir/usr/local/redis2

CP redis-server Redis-benchmark REDIS-CLI REDIS.CONF/USR/LOCAL/REDIS2

Start:

./redis-server >/dev/null &

Test:

stored value:

./REDIS-CLI Set HX Value

Value:

./REDIS-CLI Get HX

2. Installing the Phpredis module

Https://github.com/owlient/phpredis

Download Phpredis

Extract

Shell> CD Phpredis

shell>/usr/local/php/bin/phpize This phpize is the installation of the PHP module

Shell>./configure–with-php-config=/usr/local/php/bin/php-config

Shell> make

shell> make Install

next in the php.ini add extension=redis.so first to see if there is no extension_dir=/ ... .

Restart Apache or Nginx

./apachectl Restart

PHP Code Testing

$redis = new Redis ();

$redis->connect (' 127.0.0.1′,6379);

$redis->set (' Test ', ' Hello world! ');

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

?>

Output Hello world!

http://code.google.com/p/php-redis/

3.windows Installing the Redis extension

Next step: Php extended redis feature, download https://github.com/nicolasff/phpredis/downloads

5.6 Non Thread Safe (NTS) x64
Http://windows.php.net/downloads/pecl/releases/redis/2.2.7/php_redis-2.2.7-5.6-nts-vc11-x64.zip

5.6 Thread Safe (TS) x64
Http://windows.php.net/downloads/pecl/releases/redis/2.2.7/php_redis-2.2.7-5.6-ts-vc11-x64.zip

Also download the Igbinary expansion pack


1 First, view the compiled version of PHP v6/v9 in Phpinfo ()
My is MSVC9 (Visual C + + 2008) So the download is phpredis_5.4_vc9_ts.7z

2 Put the downloaded Php_igbinary.dll, php_redis.dll in the PHP extension directory (EXT), and modify the configuration file php.ini
Extension=php_igbinary.dll
Extension=php_redis.dll

3 Restart the service, view Phpinfo (), find the following to indicate success;
Redis
Redis Support Enabled
Redis Version 2.2.3

4.Redis master-Slave configuration

REDIS very simple master-slave configuration , some articles in the wordy wrote a large article, in fact, two words:

Open the redis.conf from the machine

Port 6381 ( Note: cannot be the same as the host)

sleverof 10.0.0.149 6383 ( Note: IP is host ip,6383 for host Redis port number)

Restart the console, then restart the slave

Run./redis-server redis.conf

If it appears:

The configuration is successful

Related articles:

Http://www.cnblogs.com/weafer/archive/2011/09/21/2184228.html

http://hanqunfeng.iteye.com/blog/1984387

Http://www.cnblogs.com/liuling/p/2014-4-19-02.html?ADUIN=2272650563&ADSESSION=1461547545&ADTAG=CLIENT. qq.5467_.0&adpubno=26558

How to install the PHP extension pack for Redis

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.