This article describes how to install and configure Redis and phpredis extensions on Ubuntu 18.04. Share with you for your reference, the details are as follows: 1. InstallationInstall $ sudo apt-get update $ sudo apt-get install redis-server start up $ sudo /etc/init.d/redis-server start Note: If you cannot start systemctl status redis-server.service redis-server.service: Can't open PID file /var/run/redis/redis-server
cat /var/log/redis/redis-server.log Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
vim /etc/redis/redis.conf bind 127.0.0.1 ::1
sudo redis-server /etc/redis/redis.conf &
systemctl status redis-server netstat -ntpl | grep 6379 2. Check if Redis is running$ redis-cli This command will open the following Redis prompt: 127.0.0.1:6379> Type ping 127.0.0.1:6379> ping PONG Description Successful installation 3. Configure remote login By default, redis does not allow remote login, so we need to configure it. sudo vi /etc/redis/redis.conf Comment out the following line, you can search for it #bind 127.0.0.1 Note: redis-cli -h (ip address) -p (port number defaults to 6379) Note that the parameter should be separated from the specific command by a space. 4. Configure password loginEditing the Configuration File sudo vi /etc/redis/redis.conf Find the following line and remove the comment (you can search for requirepass) #Before modification #requirepass foobared #After modification requirepass 123456 5. Restart redissudo service redis-server restart Or you can force kill and then manually open sudo killall redis-server sudo redis-server /etc/redis/redis.conf & It is best to add the configuration file here, otherwise the configuration may not take effect. 6. Install the redis extension for PHP
apt install git git clone https://github.com/phpredis/phpredis.git
mv phpredis /etc/phpredis
cd /etc/phpredis phpize
./configure make make install
vim /etc/php/7.2/apache2/php.ini Find and add the following command at the end of the php.ini file extension=redis.so
/etc/init.d/apache2 restart
<?php phpinfo(); ?> I hope this article will help you configure your Ubuntu environment. You may also be interested in:
|
<<: Solution to forgetting the root password of MySQL 5.7 and 8.0 database
>>: Lambda expression principles and examples
How to change the image hyperlink when the mouse p...
Do you know what fonts are used in the logo desig...
1 Keep the rpm package downloaded when yum instal...
This article mainly explains how to use clearfix a...
one. Preface <br />You will see this kind of...
Table of contents 1. Software and system image 2....
There are two common ways to make div background ...
This article shares the specific code for JavaScr...
1. Prepare data The following operations will be ...
Last time, a very studious fan asked if it was po...
I won't go into details about how important b...
Some time ago, the project needed to develop the ...
Simply put, delayed replication is to set a fixed...
Table of contents Conditional compilation Page La...
In HTML, <, >, &, etc. have special mean...