Install php redis expansion in ubuntu

  1. First implementation php -m, If you do not see redis, then you need to install php redis extension

  2. Download the source code, we assume that there is a git folder home directory to manage files git

    $ cd ~/git/
    $ git clone https://github.com/phpredis/phpredis.git
  3. Under the downloaded source movement to / etc files, then enter the directory

    $ mv phpredis/ /etc/
    $ cd /etc/phpredis
  4. Execution phpize generate build file, there may need to install the dev-php7.2
    Ubuntu is not installed phpize, executable command: sudo apt-get install php7.2- dev to install phpize

    $ phpize
    // 根据提示安装php7.0-dev
    $ sudo apt install php7.0-dev
  5. Compile and install

    $ sudo ./configure
    $ make && make install

    So usr \ lib \ php \ directory under 20,170,718 has been generated redis.so file, usr \ lib \ php \ 20170718 This directory is referred to in the php.ini extension_dir

  6. In the etc \ php \ 7.2 mods-available directory under increased redis.ini \, add the following extension = redis.so
    new link file

    sudo ln -s /etc/php/7.2/mods-available/redis.ini  /etc/php/7.2/cli/conf.d/20-redis.ini
  7. Restart nginx
    /etc/init.d/nginx restart

Guess you like

Origin blog.51cto.com/3154408/2408038