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 http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
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 chkconfig 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
cPanel with EasyApache 3
If the cPanel is still running with EasyApache 3, Execute below commands to install Redis PHP extension on your system. Also check Redis module is enabled for PHP.
pecl install igbinary igbinary-devel redis php -m | grep redis
All done. Redis has been installed on your system along with the PHP extension.
6 Comments
I tried this steps but not able to install redis 6.x. can you give more steps for latest version
thanks
great tutorial.. very useful
Neat and clean tutorial, thank you!
Thank you, this article help m to install Redis.
Hello,
thanks for your great article
How can I update redis to latest version?
The current version installed via this article is 4.2 but the newest version is 5
Your insight is appreciated. thank you
Thank you for this helpful tutorial. I’ve installed Redis and Predis smoothly and was able to create two instances with successful connectivity test. But now i am stuck at implemneting Redis via LiteSpeed WordPress cache where i have to mention the database ID and password. I understand that the ID should be between 0 and 16 but what I don’t understand is that should i create these database manual in prior and where can i actually specify the password so i can past it accordingly into LSWP configuration.