Under window and linux, php redis extension installation

1. Redis extension installation of php under linux

The latest version of redis php extension address: https://pecl.php.net/package/redis

1. Download the stable version of redis (stable version) and unzip it

cd /usr/local/src
wget https://pecl.php.net/get/redis-3.1.2.tgz
tar -zxvf redis-3.1.2.tgz

 

2. Installation

cd /usr/local/src/redis-3.1.2
find /usr -name phpize

Then in the redis-3.1.2 directory, execute the found phpize such as /usr/local/php/bin/phpize

Note that the above steps must be executed in the redis-3.1.2 directory.

./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

Find the path of make install

ll /usr/local/php/lib/php/extensions/no-debug-zts-20131226/

 

3. Configure php to support redis

vi /usr/local/php/lib/php.ini

:$ Add extension=redis.so to the last line

Note: It is possible that your php.ini is not in this directory, such as /etc/php.ini. You need to add extension=redis.so to /etc/php.ini    

先killall php-fpm

Restart nginx and php

 

2. Install php extension on windows

Windows redis client and server download address: https://github.com/MicrosoftArchive/redis

1. Download

Redis extension address: https://pecl.php.net/package/redis Select the stable version, click the dll icon, and select the corresponding extension according to the php version and architecture;

Download the redis extension: https://pecl.php.net/package/redis/2.2.7/windows

下载igbinary:http://windows.php.net/downloads/pecl/releases/igbinary/2.0.1/

2. Copy php_redis.dll and php_igbinary.dll to the ext directory of php

3. Modify php.ini and add:

; php_redis

extension=php_igbinary.dll

extension=php_redis.dll

 

Note: extension=php_igbinary.dll must be placed in front of extension=php_redis.dll, otherwise this extension will not take effect

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325442174&siteId=291194637