Step 1: Log in to your server
Log in to your cPanel server using your SSH client of choice.
Step 2: Install the Redis module for PHP
To install the Redis module for PHP on a specific version of PHP, you can use the pecl
command with the appropriate path to the version of PHP you want to install the module for. Run one of the following commands to install the Redis module for the desired PHP version:
For PHP 7.2:
echo no | /opt/cpanel/ea-php72/root/usr/bin/pecl install redis
For PHP 7.3:
echo no | /opt/cpanel/ea-php73/root/usr/bin/pecl install redis
For PHP 7.4:
echo no | /opt/cpanel/ea-php74/root/usr/bin/pecl install redis
For PHP 8.0:
echo no | /opt/cpanel/ea-php80/root/usr/bin/pecl install redis
For PHP 8.1:
echo no | /opt/cpanel/ea-php81/root/usr/bin/pecl install redis
For PHP 8.2:
echo no | /opt/cpanel/ea-php82/root/usr/bin/pecl install redis
Follow the on-screen prompts to complete the installation. If prompted to provide any input, type "no" and hit enter.
Step 3: Verify the Redis module is enabled
To verify that the Redis module is enabled for the version of PHP you installed it for, you can use the php -m
command to list all of the enabled PHP modules. Run the following command to check if the Redis module is enabled:
For PHP 7.2:
/opt/cpanel/ea-php72/root/usr/bin/php -m | grep redis
For PHP 7.3:
/opt/cpanel/ea-php73/root/usr/bin/php -m | grep redis
For PHP 7.4:
/opt/cpanel/ea-php74/root/usr/bin/php -m | grep redis
For PHP 8.0:
/opt/cpanel/ea-php80/root/usr/bin/php -m | grep redis
For PHP 8.1:
/opt/cpanel/ea-php81/root/usr/bin/php -m | grep redis
For PHP 8.2:
/opt/cpanel/ea-php82/root/usr/bin/php -m | grep redis
If the Redis module is installed and enabled, you should see an output similar to the following:
redis
That's all! You have learned how to install the PHP module for Redis on the cPanel server.