Install redis extension in PHP

Source: Internet
Author: User
Tags pconnect
: This article describes how to install the redis extension in PHP. if you are interested in the PHP Tutorial, refer to it. PHP extensions have a lot, refer to: http://redis.io/clients#php

Official targets are phpredis Predis. phpredis is written in C, which is highly efficient. Predis is written in PHP and can be seen directly in the source code.

Download phpredis, on the one hand is that the performance is good, on the other hand, the main is to use it to save session, address: https://github.com/phpredis/phpredis/tree/2.2.7

I don't know why there are so many branches in phpredis, or directly go down to 2.2.7.

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

After installation, add the extension information to php. ini.
extension=igbinary.so

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

Redis. so will be displayed in/usr/lib64/php/modules/. add the extension to php. ini and add it to igbinary. so.

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

Install igbinary in windows

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

Download the corresponding version of dll and 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 add it to the php. ini extension.

According to phpredis, there are two types of connection 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 lifecycle of php-fpm is valid.

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

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

The above describes how to install the redis extension in PHP, including some content, and hope to help those who are interested in the PHP Tutorial.

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.