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
  • 2 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

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...

How to Uninstall Installatron in WHM cPanel Server

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

How to Install Installatron in WHM cPanel Server

This guide will show you how to download and install Installatron on your cPanel/WHM server. To...

How to Install Softaculous with cPanel/WHM

This guide will show you how to download and install Softaculous on your cPanel/WHM server. To...