Back Back

How to Configure a Redis Database with WordPress

Redis is a very fast in-memory (RAM) database. Connected to WordPress, it caches frequently used data, so your website runs faster and the MySQL database carries less load.

What you need before you start

  • A web hosting E-COMMERCE or PLUS plan. Redis is only available on these plans.
  • A WordPress website.
  • Access to DirectAdmin and a WordPress administrator account.

Enabling Redis

  1. Open DirectAdmin

    In the service control panel, click the button that opens DirectAdmin.

    The DirectAdmin button in the service control panel.
  2. Enable Redis and copy the socket path

    Go to Advanced Features > Redis and click Enable.

    Redis is enabled with one click.

    After enabling Redis, you’ll see the Redis socket file path. Copy it, as you’ll need it in step 4.

    You’ll add this path to wp-config.php.
  3. Open the wp-config.php file

    In DirectAdmin, open System Info & Files > File Manager.

    The DirectAdmin file manager.

    Go to your WordPress directory. Replace example.com with your domain name:

    example.com/public_html/

    Open the wp-config.php file for editing.

    Open wp-config.php.
  4. Add the Redis settings

    Paste these two lines and replace the WP_REDIS_PATH value with the socket path you copied in step 2:

    define( 'WP_REDIS_SCHEME', 'unix' ); define( 'WP_REDIS_PATH', '/home/rfcfeature/.redis/redis.sock' ); // Replace with your socket path
    Where to paste?

    Paste the lines above the /* That's all, stop editing! */ line. If you paste them below it, they won’t be read.

    The added Redis settings lines.

    Save the file by clicking Save File.

  5. Install the Redis Object Cache plugin

    In the WordPress admin, go to Plugins > Add New Plugin, search for Redis Object Cache and install the plugin.

    Plugin search in WordPress.
    Installing the plugin.

    After installing, click Activate. The Redis settings page opens.

  6. Enable Object Cache

    On the Redis Object Cache page, you should see green marks next to Filesystem: Writable and Redis: Reachable. Click Enable Object Cache.

    Both marks must be green.

Did it work?

Once Object Cache is enabled, the status should show Connected and you’ll see cache statistics below.

Redis is connected and caching WordPress data.

FAQ

It shows “Redis: Not Reachable”

Check that Redis is enabled in DirectAdmin and that the WP_REDIS_PATH value exactly matches the socket path. The path in your account will differ from the example /home/rfcfeature/.redis/redis.sock.

I see old data on the site after making changes

In the Redis Object Cache settings, click Flush Cache. This clears the cache and the site shows the latest data right away.

I use the LiteSpeed Cache plugin. Do I need Redis?

You can use both: LiteSpeed Cache caches whole pages, while Redis caches database queries. Just don’t enable Object Cache in both plugins at the same time.

How do I disable Redis?

In the plugin settings, click Disable Object Cache, deactivate the plugin and remove both added lines from wp-config.php.

What’s next

If you run into trouble, contact us via live chat or email.

Similar tutorials

Shared Hosting Tutorials