• Resolved wholesometrex

    (@wholesometrex)


    Hello,
    I am attempting to use W3 Total Cache with Redis, but all options for any caching methods other than “Disk” and “Disk: Enhanced” are grayed out and unable to be selected on any of the caching sections… I would very much like to utilize Redis for all the caching methods here.

    Environment:
    Docker containers:

    • wordpress:5.4-php7.4
    • mysql:5.7
    • redis

    I have confirmed that Redis is working and is connected through the Redis Object Cache plugin. I had to modify the wp-config.php to include the Redis configuration information. I also added in the db-config.php file within the W3 cache plugin directory with the following settings:

    //
    // redis config cache
    //
    define( 'W3TC_CONFIG_CACHE_ENGINE', 'redis');
    define( 'W3TC_CONFIG_CACHE_REDIS_SERVERS', 'site1-cache::6379' );
    
    // optional redis settings
    define( 'W3TC_CONFIG_CACHE_REDIS_PERSISTENT', true );
    define( 'W3TC_CONFIG_CACHE_REDIS_DBID', 0 );
    define( 'W3TC_CONFIG_CACHE_REDIS_PASSWORD', '' );

    wp-config.php (redis section)

    /** Define Redis Caching **/
    define('WP_REDIS_HOST', 'site1-cache');
    //define('WP_REDIS_CLIENT', 'predis'); // appears that even though PHPredis is specified below, the plugin still utilizes predis
    define('WP_REDIS_CLIENT', 'phpredis');
    //define('WP_CACHE', 'true'); // this is already defined at the top of the file.
    define('WP_CACHE_KEY_SALT', 'site1');
    define('WP_REDIS_DISABLE_BANNERS', 'true');
    define('WP_REDIS_DATABASE', '0');
    define('WP_REDIS_TIMEOUT', '5'); // timeout in seconds
    define('WP_REDIS_READ_TIMEOUT', '5'); // Read timeout in seconds
    define('WP_REDIS_RETRY_INTERVAL', '100'); // Retry interval in milliseconds

    Is there something that I’m doing wrong in order for W3 to actually recognize Redis as an option for caching?

Viewing 4 replies - 1 through 4 (of 4 total)
  • create a redis.ini in /etc/php/7.x/apache2/conf.d then restart apache2
    It worked for me.

    cd /etc/php/7.x/apache2/conf.d
    sudo nano redis.ini

    extension=redis.so

    sudo apache2ctl restart

    Thread Starter wholesometrex

    (@wholesometrex)

    I think the issue here is that within the WordPress Docker container, it handles everything very differently.

    PHP Conf.d is actually at /usr/local/etc/php/conf.d …
    I mapped this location and ensure that the redis.ini file you suggested exists within the container, however, W3 cache still isn’t picking up the ability to choose anything other than Disk for any caching options.

    I’m not an expert. But I did have the exact same problem as you do. I’ve tried many suggestions and only this one worked for me.

    When I run find / -xdev 2>/dev/null -name "conf.d"
    Results

    /etc/php/7.4/apache2/conf.d
    /etc/php/7.4/cli/conf.d
    /etc/php/7.2/cli/conf.d
    /etc/initramfs-tools/conf.d
    /etc/fonts/conf.d
    /usr/share/initramfs-tools/conf.d

    I also tested this, remove the redis.ini file in /etc/php/7.4/apache2/conf.d and restart apache2. The same issue occurred again.

    Good luck.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @wholesometrex
    Thank you for your inquiry and I am happy to assist you with this.
    You need to install phpredis. Without phpredis, W3TC will not detect REDIS.
    Check this article for more details.
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Unable to select alternative caching methods from drop-down, only Disk available’ is closed to new replies.