Get the App
SLTechnology News&Howtos  ›  Database  › 

Installation steps for redis source code and phpredis extension

Shulou Source: shulou.com Published: 2022-06-01 19:03:38 09月19日 Update

Today, the editor will bring you an article that introduces the redis source code and the installation steps of the phpredis extension. The editor thinks it is very practical, so I will share it for you as a reference. Let's follow the editor and have a look.

First, we need to download the installation package. Download address:

Http://download.redis.io/releases/redis-5.0.5.tar.gz

Redis does not have any dependencies, so there is no problem with the general installation. If there is a problem, update gcc. The installation process is as follows:

1. Download the installation package

# wget http://download.redis.io/releases/redis-5.0.5.tar.gz

two。 Extract and install

It will take some time to compile the make. Please wait patiently.

# tar-zxf redis-5.0.5.tar.gz# cd redis-5.0.5# make # make PREFIX=/usr/local/redis install

3. Create a new redis configuration file directory and data storage directory

# mkdir / usr/local/redis/etc / usr/local/redis/var

4. Copy and modify the configuration file

# cp redis.conf / usr/local/redis/etc/# vim / usr/local/redis/redis.conf

If you find the daemonize no line, change no to yes, which means running in daemon mode to find dir, and changing it to / usr/local/redis/var to indicate that the data is stored in this directory.

4. Make soft links

Ln-s / usr/local/redis/bin/* / usr/local/bin/

5. Start redis and test if it is working properly

# systemctl start redis-server# redis-cli127.0.0.1:6379 > pingPONG

The presence of PONG means success.

Install the phpredis extension

The prerequisite must be that the server already has php installed. If there is no installation, install it first. Let's not talk about how to install php here.

The address of the installation package is here to see http://pecl.php.net/package/redis. Here I download the latest stable version

# wget http://pecl.php.net/get/redis-5.2.2.tgz

The installation steps are as follows:

1. Decompress

# tar-zxf redis-5.2.2.tgz# cd redis-5.2.2

two。 Run phpize

/ usr/local/php/bin/phpize

3. Installation

#. / configure-- with-php-config=/usr/local/php/bin/php-config # make# make install

4. Modify php.ini

Open the php.ini file and add a new line

Extension=redis

5. Check whether the extension is installed successfully

# php-m | grep redis

Check to see if a redis is present.

Turn off the redis service

You can use the systemctl command normally. One thing to note here is not to use kill-9 to kill. As a result, redis is not only not persistent, but also very easy to cause data loss.

On the redis source code and phpredis extension installation steps to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you like this article, you might as well share it for more people to see.

Tags: File step data directory configuration source code success address more problem service run utility patience for this one line representative content premise consequence Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux vpn Redmi macOS MariaDB