Install Redis and Redis PHP extension for cPanel Server


This article provides a guide for how to install Redis and Redis PHP extension for cPanel server.

How to Install Redis and Redis PHP extension for cPanel Server

To install Redis and Redis PHP extension for cPanel server, follow the steps below:

  1. Login via SSH as root user.
  2. Run the following commands:
    rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
    yum -y install redis --enablerepo=remi --disableplugin=priorities
    systemctl enable redis
    systemctl start redis
  3. Now run the following:
    for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
    cd ~
    wget -O redis.tgz https://pecl.php.net/get/redis
    tar -xvf redis.tgz
    cd ~/redis* || exit
    /opt/cpanel/"$phpver"/root/usr/bin/phpize
    ./configure --with-php-config=/opt/cpanel/"$phpver"/root/usr/bin/php-config
    make clean && make install
    echo 'extension=redis.so' > /opt/cpanel/"$phpver"/root/etc/php.d/redis.ini
    rm -rf ~/redis*
    done
    
    /scripts/restartsrv_httpd
    /scripts/restartsrv_apache_php_fpm
  4. The redis package and PHP extensions should now be installed. To check, run the following command:
    for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
    echo "PHP $phpver" ; /opt/cpanel/"$phpver"/root/usr/bin/php -i |grep "Redis Support"
    done
  5. If successful, the output will be similar:
    check Redis installation for cPanel server

CentOS 8/AlmaLinux 8/Rocky Linux 8

  • For CentOS/AlmaLinux/Rocky Linux 8 cPanel servers, adjust the command as follows:
    rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-8.rpm
    yum -y install redis --enablerepo=remi --disableplugin=priorities
    systemctl enable redis
    systemctl start redis
  • Followed by:
    for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
    cd ~
    wget -O redis.tgz https://pecl.php.net/get/redis
    tar -xvf redis.tgz
    cd ~/redis* || exit
    /opt/cpanel/"$phpver"/root/usr/bin/phpize
    ./configure --with-php-config=/opt/cpanel/"$phpver"/root/usr/bin/php-config
    make clean && make install
    echo 'extension=redis.so' > /opt/cpanel/"$phpver"/root/etc/php.d/redis.ini
    rm -rf ~/redis*
    done
    
    /scripts/restartsrv_httpd
    /scripts/restartsrv_apache_php_fpm

That's it. You now know how to install Redis and Redis PHP extensions on cPanel server.

  • redis, cache, cpanel workaround, whm, install php extensions, installation, cpanel setup
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Remove a Service from ChkServd Monitoring for cPanel Servers

This guide requires root user account in server. In some circumstances, ChkservD cPanel...

Assigning a Dedicated IP Address to a Subdomain using WHM

To assign a dedicated IP address to a subdomain, perform the following steps: Step 1: Add the...

Enable Lets Encrypt AutoSSL Provider

This article refers to cPanel version 84 and later. Enable Let's Encrypt for AutoSSL Follow...

How to Fix Incorrect cPanel Account Quotas and Disk Usage

This article will provide a step-by-step guide to fix incorrect account quotas and disk usage on...

How to Uninstall Installatron in WHM cPanel Server

This guide will show you how to quickly uninstall Installatron software from WHM/cPanel server....