Installing Redis
First, you need to install Redis in the Linux system. The installation can be completed through the following command:
sudo apt-get install redis-server
After the installation is completed, you can use the following command to check whether the Redis service has been started:
sudo service redis-server status
If the service has been started, results similar to the following will be output. :
redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2020-10-27 11:17:38 CST; 2 days ago Docs: http://redis.io/documentation, man:redis-server(1) Process: 4187 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS) Process: 4188 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS) Main PID: 4223 (redis-server) Tasks: 4 (limit: 4915) CGroup: /system.slice/redis-server.service └─4223 /usr/bin/redis-server 127.0.0.1:6379
Install PHP extension
php -v
sudo apt-get install php-redis
sudo vi /etc/php/7.0/apache2/php.ini
;extension=redis.so
extension=redis.so
sudo service apache2 restart
The above is the detailed content of How to install redis and php extensions under lunix. For more information, please follow other related articles on the PHP Chinese website!