• Hello all,

    as part of hardening my setup i changed from a local redis without password to one with password (I literally just set the password in redis.conf). After updating the repective config, Nextcloud is able to connect via socket.
    WordPress (Redis object cache) though seems unable to connect via
    – TCP and
    – Socket

    In the plugin overview tab I see the redis cache is writeable and reachable, but when I click on activate, the site breaks with a redis connection error. I tried digging logfiles on various ends (php-fpm, redis, nginx…) but I cant see any helpful message relating to redis / auth.

    WordPress si 7.1., may that is an issue?

    Kind regards,
    Martin

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter smartysmart34

    (@smartysmart34)

    Addition: I tested the following:
    – redis-cli PING with the password I copy&pasted out of the wp-config: PONG
    – created a php script in the wordpress root directory. That script took connection details and password out of wp-config and tried to connect to redis: success

    So a connection to redis is possible, but redis Object Cache is unable to connect succesfully.

    Plugin Author Till Krüss

    (@tillkruess)

    What is the exact connection error?

    Thread Starter smartysmart34

    (@smartysmart34)

    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](https://github.com/rhubarbgroup/redis-cache/blob/develop/INSTALL.md).
    To disable Redis, delete the object-cache.php file in the /wp-content/ directory.

    Thread Starter smartysmart34

    (@smartysmart34)

    For completeness: These values I put inside wp-config.php:
    define(‘WP_REDIS_SCHEME’, ‘unix’);
    define(‘WP_REDIS_PATH’, ‘/var/run/redis/redis.sock’);
    define(‘WP_REDIS_PORT’, 0 );
    define(‘WP_REDIS_DATABASE’, ‘0’);
    define(‘WP_REDIS_PASSWORD’, ‘*****************************’);

    Tried with varying combinations of with and without Port, with and without Database, With REDIS_PATH and REDIS_HOST… Nothing works. The above is in right now and when I click on “activate” the site goes down. WIth the parameters in this update the message is sligtly different from what I posted earlier:

    Error establishing a Redis connection
    NOAUTH Authentication required.
    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.

    So now it is “Authentication required which is funny, I provided the password…

    BEFORE clicking on “activate”, this is what the overview page shows:
    Status: Nicht aktiviert – Not activated
    Dateisystem: Beschreibbar – Writeable
    Redis: Erreichbar – Reachable

    Plugin Author Till Krüss

    (@tillkruess)

    Did you define the WP_REDIS_ too late in the config?

    This is quite weird, if it says Reachable but then doesn’t recognize the auth. Can you try setting WP_REDIS_CLIENT = predis to see if that solves it?

    Thread Starter smartysmart34

    (@smartysmart34)

    Hello Till, thank you for looking into my issue. A bit of context before some paste:

    My setup has been up and running with Redis (no password) for quite some time now. In an attempt to further harden things, I revisited some of the settings, including the introduction of a redis password.
    WordPress is running in a separate PHP-Pool, with a separate user, but this was also the case before the password introduction. The wordpress php-pool-user is member of the redis group, just like the nextcloud user.
    I even removed some special characters from the Password to make sure it is not interfering with string-operations. With no success.

    I have been testing further. This is what the bottom part of my wp-config.php looks like right now:


    define('FS_METHOD', 'direct');

    /*define( 'WP_ALLOW_REPAIR', true );*/

    //define( 'WP_REDIS_HOST', '127.0.0.1' );
    //define( 'WP_REDIS_PORT', 6379 );
    //define( 'WP_REDIS_PASSWORD', 'PwdFRedis_Cbr1100xx!!_4711' );

    //define('WP_REDIS_CLIENT', 'pecl');
    define( 'WP_REDIS_CLIENT', 'predis' );
    define('WP_REDIS_SCHEME', 'unix');
    define('WP_REDIS_PATH', '/var/run/redis/redis.sock');
    define('WP_REDIS_PORT', null );
    define('WP_REDIS_DATABASE', '1');
    //define('WP_REDIS_HOST', '/var/run/redis/redis.sock');
    define('WP_REDIS_PASSWORD', '***************************');
    //define('WP_REDIS_PORT', 0 );

    /* Das war’s, Schluss mit dem Bearbeiten! Viel Spaß beim Bloggen. */
    /* That's all, stop editing! Happy blogging. */

    This is, what the plugin-diagnosis gives me in the WP-Admin panel:

    Status: Nicht aktiviert
    Client: predis
    Drop-in: Not installed
    Disabled: No
    PhpRedis: 6.2.0
    Relay: Not loaded
    Predis: 2.4.0
    Credis: Not loaded
    PHP Version: 8.4.24
    Plugin Version: 2.8.0
    Redis Version: Unknown
    Multisite: No
    Metrics: Disabled
    Metrics recorded: 0
    Filesystem: Writable
    WP_REDIS_CLIENT: "predis"
    WP_REDIS_SCHEME: "unix"
    WP_REDIS_PATH: "/var/run/redis/redis.sock"
    WP_REDIS_PORT: null
    WP_REDIS_DATABASE: "1"
    WP_REDIS_PLUGIN_PATH: "***************/wp-content/plugins/redis-cache"
    WP_REDIS_PASSWORD: ••••••••
    Drop-ins: []

    The Overview still goes:

    Status: Nicht aktiviert
    Dateisystem: Beschreibbar
    Redis: Erreichbar

    When I click on “Activate” -> Site is down… Same message

    What else could influence this? Do you need some specific information?

    Thank you for your support, I really appreciate it.
    Cheers
    Martin

    Plugin Author Till Krüss

    (@tillkruess)

    Hi Martin, thanks for confirming.

    Did you try using version 3.0.0 I pushed out yesterday, does it behave any differently?

    Thread Starter smartysmart34

    (@smartysmart34)

    Yes I tried, No – not differently. Same message: Authentication required.

    What else can I provide to help investigating?

    i am using App Armor but that has also been there from the beginning. And as the redistest.php I briefly had in the root directory was handeled by the same wordpress php-pool user and succeeded connecting with the socket and password from wp-config, I think I can rule that one out.

    Also, aa-logprof does not show any pending audit log entries.

    srwxrwx— 1 redis redis 0 18. Sep 10:01 redis.sock

    Kind regards,

    Martin

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.