Get the App
SLTechnology News&Howtos  ›  Database  › 

Install the php redis extension in ubuntu

Shulou Source: shulou.com Published: 2022-06-01 08:49:50 10月03日 Update

Execute php-m first. If you don't see redis, you need to install the php redis extension.

To download the source code, we assume that there is a git folder in the home directory to manage git files

$cd ~ / git/$ git clone https://github.com/phpredis/phpredis.git

Move the downloaded source code to the / etc file, and then enter this directory

$mv phpredis/ / etc/$ cd / etc/phpredis

Execute phpize to generate compilation files, where you may need to install php7.2-dev

Ubuntu does not have phpize installed, execute the command: sudo apt-get install php7.2-dev to install phpize

Phpize// install php7.0-dev$ sudo apt install php7.0-dev according to the prompts

Compilation and installation

$sudo. / configure$ make & & make install

In this way, the redis.so file has been generated in the usr\ lib\ php\ 20170718 directory, and the directory usr\ lib\ php\ 20170718 is the extension_dir in php.ini.

Add redis.ini to the etc\ php\ 7.2\ mods-available directory and add the following content extension=redis.so

Add link file

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

Tags: Files directories source code generation compilation content commands that is referenced folders Laian prompts moves management Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft Shulou Tech Info MariaDB Xiaomi