To install PHPRedis on your server you will have to login as root user and follow these commands:
1. Install php-pear package:
apt install -y php-pear
2. Install redis client:
printf "no\n" | pecl install redis
3. Add extension to mods:
echo "extension=redis.so" > /etc/php/7.3/mods-available/redis.ini
4. Symlink FPM:
ln -sf /etc/php/7.3/mods-available/redis.ini /etc/php/7.3/fpm/conf.d/20-redis.ini
5. Symlink CLI:
ln -sf /etc/php/7.3/mods-available/redis.ini /etc/php/7.3/cli/conf.d/20-redis.ini
6. Restart service:
systemctl restart php7.3-fpm.service
When you have a different PHP version like 7.2, make sure to replace the version number in the commands so it matches your version and re-run the commands.