Home  >  Article  >  Backend Development  >  PHP adds Redis module

PHP adds Redis module

WBOY
WBOYOriginal
2016-08-08 09:19:58782browse

 The previous articles introduced the installation and use of Redis. Next, we will introduce how to add Redis extension to PHP!

 The PHP manual does not provide Redis classes and methods, nor does it provide related extension modules, but we can download PHP extensions from the Redis official website. There are many extensions in it. We only take phpredis as an example.

  1. phpredis download
    1. Click "Repository" to enter the Redis learning library, which contains Redis extended code files and related introductions as well as classes and methods
    2. Click "releases" to enter the source file of phpredis
    3. Download the latest version phpredis source file, select "tar.gz" to download
  2. phpredis configuration
    1. Unzip the phpredis file

      <span>1</span> tar -zxvf phpredis-2.2.7.tar.gz
    2. Install and configure phpredis
      1. Run the phpize5 command in the phpredis directory to generate the configure file

        phpize5
      2. Install and configure igbinary

        wget http:<span>//</span><span>pecl.php.net/get/igbinary-1.2.1.tgz</span>./<span>configure
        make
        sudo make install</span>
      3. Install and configure phpredis

        ./configure --enable-redis-<span>igbinary
        make <br></span>sudo make install
      4. Modify php.ini and add (in order, add igbinary.so first, then redis.so)

        extension=igbinary.<span>so
        extension</span>=redis.so
  3. View phpredis

Use phpinfo() to view

Reference document:

Php-Redis installation test summary

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

Statement:
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