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
Table of contents Environmental Description Docke...
Note: This demo is tested in the mini program env...
1. Using it with redis will cause Netty startup c...
NAT In this way, the virtual machine's networ...
Table of contents Write docker-compose.yml Run do...
Use the following command to check whether MySQL ...
MySQL 8.0 service cannot be started Recently enco...
Copy code The code is as follows: <BODY> //...
Environment Preparation Docker environment MySQL ...
Table of contents First method App.vue Home.vue H...
I finished reading "Patterns for Sign Up &...
PHP7 has been out for quite some time, and it is ...
I accidentally found that Vue.$set was invalid in...
From the backend to the front end, what a tragedy....
There are some tags in XHTML that have similar fu...