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
extension=igbinary.so
phpize ./configure [--enable-redis-igbinary] make && make install
==================================================== =================================
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.