All Hosting Plan Are Also Available On Monthly, Quarterly And Semi-Annually.
< All Topics
Print

How to Install Redis and PHP Redis on a cPanel Server

Installing Redis and the PHP Redis extension on a cPanel server can significantly improve the performance of your web applications by enabling caching. The process involves two main parts: installing the Redis server itself on your machine and then installing the PHP extension that allows your applications to communicate with the Redis server.

Installing Redis on the cPanel Server

This process requires root access to your server via SSH.

  1. Update the Server: Before installing new software, it’s a good practice to ensure all existing packages are up-to-date.
    • Log in to your server via SSH as the root user.
    • Run the update command: yum update -y
  2. Install the Redis Server: On a CentOS-based system (which cPanel typically uses), Redis is not in the default repository, so you must install the Remi or EPEL repository first.
    • Install the EPEL repository: yum install epel-release -y
    • Install Redis: yum install redis -y
  3. Start and Enable Redis: After the installation is complete, start the Redis service and configure it to run automatically on boot.
    • Start Redis: systemctl start redis
    • Enable Redis on boot: systemctl enable redis
  4. Verify the Installation: You can check if the Redis service is running by using the systemctl status redis command. The output should show that the service is “active (running).”

Installing the PHP Redis Extension

The PHP Redis extension acts as a bridge between your PHP applications and the Redis server. You can install it through WHM’s graphical interface.

  1. Log in to WHM: Access your WebHost Manager as the root user.
  2. Navigate to the PECL Installer: In the WHM search bar, type “Module Installers” and select it under the Software section.
  3. Find PHP PECL: On the Module Installers page, click on Manage next to “PHP PECL.”
  4. Search for Redis: In the PHP PECL section, use the search box to find the “redis” module and click Go.
  5. Install the Extension: The search results will show the PHP Redis extension. Click the Install button next to it. WHM will then compile and install the extension for all active PHP versions on your server.
  6. Restart Services: To apply the changes, it’s best to restart the web server and the Redis service.
    • Restart Apache: systemctl restart httpd
    • Restart Redis: systemctl restart redis

After completing these steps, you can create a phpinfo() file on your website and search for “redis” to verify that the extension is properly enabled.

Table of Contents

Windows Hosting is comming soon. All Hosting Plan Are Also Available On Monthly, Quarterly And Semi-Annually.

Call back request.