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:
    cd ~
    wget -O redis.tgz https://pecl.php.net/get/redis
    tar -xvf redis.tgz
    rm -f redis.tgz
    cd ~/redis*
    
    for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
    /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
    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
    dnf -y install redis --enablerepo=remi --disableplugin=priorities
    systemctl enable redis
    systemctl start redis
  • Followed by:
    cd ~
    wget -O redis.tgz https://pecl.php.net/get/redis
    tar -xvf redis.tgz
    rm -f redis.tgz
    cd ~/redis*
    
    for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
    /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
    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.

Launch 100% SSD VPS from $2.49/mo!

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

Related Articles

Disable Network Manager on CentOS 7

This article will provide the steps to disable Network Manager in CentOS 7. Network Manager is...

Disable Network Manager on CentOS 6

This article will provide the steps to disable Network Manager in CentOS 6. Network Manager is...

How to Find the IP of cPanel/WHM Server

This tutorial is designed to troubleshoot and diagnose issues with cPanel license errors. Find...

Uninstall WHMXtra on cPanel Server

This article provides a quick and direct guide for uninstalling the WHMXtra plugin from a...

How to Customize cPanel Installation

This article provides a guide for customizing a cPanel server installation, using the...