Home > Backend Development > PHP Tutorial > PHP install redis extension

PHP install redis extension

WBOY
Release: 2016-07-29 09:15:40
Original
877 people have browsed it

There are many PHP extensions, refer to: http://redis.io/clients#php

The official star is phpredis Predis, phpredis is written in C, and it will be written more efficiently. Predis is written in PHP, which can be seen directly Source code.

Download phpredis. On the one hand, I think it has good performance. On the other hand, I mainly use it to store sessions. Address: https://github.com/phpredis/phpredis/tree/2.2.7

I don’t know why phpredis has There are so many branches, so just download 2.2.7 directly.

Before installing phpredis, you need to install an extension of igbinary because it will be used. Reference: https://pecl.php.net/package/igbinary

pecl install igbinary
Copy after login

After installation, add extension information to php.ini
extension=igbinary.so
Copy after login

The installation method is also very simple, reference: https://github.com/phpredis/phpredis/tree/master#installation
phpize
./configure [--enable-redis-igbinary]
make && make install
Copy after login

You will see redis.so in /usr/lib64/php/modules/, add and expand it to php.ini, and be sure to add it after igbinary.so.

==================================================== =================================

Install igbinary under windows

Reference: https://pecl.php .net/package/igbinary/1.2.1/windows

Download the corresponding version of dll, and also add it to the php.ini extension.

Reference: http://windows.php.net/downloads/pecl/snaps/redis/2.2.5/

Download the corresponding version of dll, and also add it to the php.ini extension.

According to the phpredis description, there are two types of connections to redis: connect and pconnect. According to the reference materials, pconnect's close() only does not allow php to continue accessing redis, and does not directly close the connection. The entire php-fpm life cycle is valid.

Reference: http://m.blog.csdn.net/blog/qmhball/46988111

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the installation of redis extension in PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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