• Resolved jomo

    (@jonathanmoorebcsorg)


    Noting the recommendation in the 1.5.0 change log “Since Predis isn’t maintained any longer, it’s highly recommended to switch over to PhpRedis (the Redis PECL extention).”
    what is the procedure for switching from Predis to PhpRedis?
    many thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Nothing, just change your config and flush the cache of you have any issues.

    hoy

    (@whereskarlo)

    Should we add this to wp-config.php and then flush the cache?

    define( 'WP_REDIS_CLIENT', 'pecl' );

    Trying to figure this out myself at the moment.

    Plugin Author Till Krüss

    (@tillkruess)

    @whereskarlo: Correct, you got it!

    hoy

    (@whereskarlo)

    It didn’t work. However, upgrading to PHP 7.3 took care of it and I now have PhpRedis. No edit to wp-config was necessary in the end.

    Thread Starter jomo

    (@jonathanmoorebcsorg)

    @whereskarlo I assume you must have that define( 'WP_REDIS_CLIENT', 'pecl' ); in the wp-config still.

    I’m running under PHP7.3 and it doesn’t automatically switch over,
    If I look at object-cache.php if WP_REDIS_CLIENT the default is still predis if the WP_REDIS_CLIENT is not defined.

    
            $client = defined('WP_REDIS_CLIENT') ? WP_REDIS_CLIENT : null;
    
            if (class_exists('Redis') && strcasecmp('predis', $client) !== 0) {
                $client = defined('HHVM_VERSION') ? 'hhvm' : 'pecl';
            } else {
                $client = 'predis';
            }
    

    in any case it does not switch over to phpredis in my case even with the suggested define( 'WP_REDIS_CLIENT', 'pecl' ); added to wp-config

    Plugin Author Till Krüss

    (@tillkruess)

    You probably added the constant to late in your config.

    Thread Starter jomo

    (@jonathanmoorebcsorg)

    no, I just haven’t installed the PhpRedis pecl.
    Not clear whether it is urgent to do so at this stage or whether it has any immediate benefits.

    @jonathanmoorebcsorg using the native module has much better performance. I would recommend using it, especially since it’s really easy to do.

    Ubuntu/Debian
    apt-get install -y php-redis

    Centos/Redhat
    yum install -y php-pecl-redis

    Alpine Linux in Docker (because I just had to set this up…)

    RUN set -xe \
        && apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS \
        && pecl install -o -f redis \
        && docker-php-ext-enable redis \
        && apk del .phpize-deps
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘what is the procedure for switching from Predis to PhpRedis?’ is closed to new replies.