WebGee DocsDocs
WordPress

Use Redis object caching without LiteSpeed Cache

Set up Redis object caching on a WordPress site that uses a caching plugin other than LiteSpeed Cache, using the Redis Object Cache plugin.

Enable Redis object caching on a WordPress site that does not use LiteSpeed Cache. Applies to shared, reseller and Premium hosting.

If you do use LiteSpeed Cache, it has object caching built in and you do not need a second plugin — see Enable Redis object caching instead.

LiteSpeed Cache is the recommended caching plugin on WebGee. It talks directly to the LiteSpeed web servers your sites run on, which no other plugin can do. This article is for sites already committed to a different caching plugin.

1. Enable Redis in cPanel

  1. In cPanel, open Redis.

  2. Select Enable Redis.

  3. Copy the socket path shown. You need it in step 3.

    The Redis Manager page in cPanel showing the socket path

You can return to this page at any time to see it again.

2. Enable the PHP extension

  1. In cPanel, open Select PHP Version.
  2. Select Extensions.
  3. Tick redis.

3. Install and configure the plugin

  1. In WordPress, go to Plugins → Add New.

  2. Search for Redis Object Cache — the one by Till Krüss.

  3. Select Install Now, then Activate.

  4. Edit wp-config.php and add the socket path from step 1, above the line that reads /* That's all, stop editing! */:

    define( 'WP_REDIS_SCHEME', 'unix' );
    define( 'WP_REDIS_PATH', '/home/cpaneluser/.redis/redis.sock' );
  5. In WordPress, go to Settings → Redis and select Enable Object Cache.

Check it worked

On Settings → Redis, the status should read Connected.

If it does not:

  • Connection refused — Redis is not enabled. Re-check step 1.
  • Class 'Redis' not found — the PHP extension is off. Re-check step 2.
  • The socket path is wrong. Copy it again from cPanel → Redis; it is regenerated whenever Redis is disabled and re-enabled.

If you run several WordPress sites on one account

Redis Object Cache uses the WordPress database table prefix as its cache key prefix. Two sites sharing a prefix will share cache entries, and each will start serving fragments of the other — usually seen as the wrong site name, wrong menu or wrong post content appearing at random.

This only happens when all of the following are true:

  • The sites were installed manually rather than through Softaculous, which assigns a unique prefix automatically.
  • Two or more of them use the same prefix, typically the default wp_.
  • More than one has Redis Object Cache active.

To fix it, give each site a distinct table prefix, or set a distinct cache key prefix per site in wp-config.php:

define( 'WP_REDIS_PREFIX', 'site1_' );

Deactivating the plugin resolves the symptoms immediately while you sort the prefixes out.

On this page