• Hello Till,

    I’m reaching out regarding an issue we’ve encountered when using the Redis Object Cache plugin with a fresh installation of WordPress 6.7.1. Despite following the official setup guidelines, our WordPress site fails with the following error:

    Error establishing a Redis connection

    Connection refused

    WordPress is unable to establish a connection to Redis. This means that the connection information in your wp-config.php file are incorrect, or that the Redis server is not reachable.

    • Is the correct Redis host and port set?
    • Is the Redis server running?

    If you need help, please read the?installation instructions.

    To disable Redis, delete the object-cache.php file in the /wp-content/ directory.

    Here are the details of our setup:

    1. WordPress Version: 6.7.1 (fresh installation)
    2. Redis Plugin Version: Redis Object Cache 2.5.4
    3. Server Environment:
      • Dockerized Setup: Using docker-compose
      • Relevant Containers:
        • WordPress (wordpress:php8.0-fpm)
        • Redis (redis:alpine)
        • WP-CLI (custom-wordpress-cli built on the official WP-CLI image)
        • Nginx (nginx:alpine) for frontend
        • MariaDB (mariadb:latest) for the database
        • Varnish (varnish:stable) for caching
    4. Redis Configuration:
      • Redis is running in the my-redis container and is reachable from other containers within the Docker bridge network (my_network).
      • Redis configuration: Default Alpine Redis settings (bind *, protected-mode no).
    5. wp-config.php Constants for Redis
      • define("WP_REDIS_HOST", "my-redis");
      • define("WP_REDIS_PORT", 6379);
      • define("WP_REDIS_DATABASE", 0);
      • define("WP_REDIS_DEBUG", true);
      • define("WP_DEBUG", true);
      • define("WP_DEBUG_LOG", true);
      • define("WP_DEBUG_DISPLAY", false);
      • @ini_set("display_errors", 0);
      • define("WP_REDIS_TIMEOUT", 5);
      • define("WP_REDIS_READ_TIMEOUT", 5);
    6. Plugin Behavior:
      • Activating the plugin creates the object-cache.php drop-in at /wp-content/.
      • The Redis server is accessible (PONG response from Redis CLI within the WordPress container).
      • Enabling Object Cache via the plugin causes the “Error establishing a Redis connection” issue.

    Steps we’ve tried:

    1. Verified network connectivity:
      • Pinged my-redis from the WordPress container (ping my-redis works).
      • Successfully executed redis-cli -h my-redis ping from the WordPress container (PONG response).
    2. Reviewed Redis logs:
      • No errors in Redis logs, and CONFIG GET shows the expected settings (bind, protected-mode, etc.).
    3. Tested Redis connectivity from WP-CLI:
      • WP-CLI reports Redis as reachable, but enabling Object Cache causes the same error.
    4. Tried replacing the object-cache.php file:
      • Replaced it with the latest version from the plugin’s GitHub repository (branch: develop).
    5. Reinstalled the plugin:
      • Deactivated, uninstalled, and reinstalled the Redis Object Cache plugin. The error persisted.
    6. Checked for known compatibility issues:
      • Verified that Redis Object Cache 2.5.4 supports Redis 7.4.1 and PHP 8.0.

    Summary of issue

    • Redis is reachable and functional, yet WordPress fails to connect when Object Cache is enabled.
    • The error specifically points to RedisException: Connection refused in /wp-content/object-cache.php.
    • We suspect a compatibility issue between Redis Object Cache and WordPress 6.7.1 but have not found evidence of this in community forums or issue trackers.

    Questions:

    1. Are there known issues with the Redis Object Cache plugin and WordPress 6.7.1 or Redis 7.4.1?
    2. Could this be related to the object-cache.php drop-in, or should we consider alternative configurations for Redis?
    3. Are there any additional debug steps or alternative plugin versions (e.g., pre-releases) we should test?
Viewing 1 replies (of 1 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    If your redis-cli -h my-redis ping works from within the WordPress container, it can only be the plugin configuration. Have you tried moving all WP_REDIS_* constants to the top of the wp-config.php file?

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this review.