How to Install Redis on cPanel

Redis is an in-memory data structure store, used as database server, cache and message broker. It also provides PHP module for communication between PHP script with Redis server.

This guide will help you for the installation of Redis server and binding with PHP using Redis PHP extensions on a cPanel server.

Step 1 – Prerequisites

In order to use this tutorial, you must have root shell access of your WHM/cPanel server. Login to your server shell access using root account.

ssh [email protected]

Redis packages are not available under default yum repositories. You need to enable EPEL yum repository on your server first. Execute below command to enable:

### CentOS/RHEL 7 
yum install epel-release

### CentOS/RHEL 6 
rpm -Uvh

Step 2 – Install Redis Server

Now, You can use yum package manage to install Redis server packages by executing below command

yum install redis

After successfully installation start Redis service and enable to auto-start on system reboot.

### CentOS/RHEL 7 
systemctl enable redis
systemctl start redis

### CentOS/RHEL 6 
sourcechkconfig redis on
service redis restart

Redis server is up and running on your system. Go to next step to enable Redis PHP extension on your cPanel server.

Step 3 – Install Redis PHP extension

In this step there are two option available based in the EasyApache version on your cPanel server. Follow one of below step:

cPanel with EasyApache 4

You can install Redis PHP extension for all installed PHP version on your system or install for the active version only. We recommend to install for all versions.

PHP 5.6

/opt/cpanel/ea-php56/root/usr/bin/pecl install igbinary igbinary-devel redis 
/opt/cpanel/ea-php56/root/usr/bin/php -m | grep redis

PHP 7.0

/opt/cpanel/ea-php70/root/usr/bin/pecl install igbinary igbinary-devel redis 
/opt/cpanel/ea-php70/root/usr/bin/php -m | grep redis

PHP 7.1

/opt/cpanel/ea-php71/root/usr/bin/pecl install igbinary igbinary-devel redis 
/opt/cpanel/ea-php71/root/usr/bin/php -m | grep redis


Tags: ,

Was this helpful?