Support » Plugin: Redis Object Cache » Connecting heroku redis

  • Resolved johnsyin97

    (@johnsyin97)


    Hi, I am unable to connect to the Heroku Redis add-on.

    I am getting the message: Drop-in is invalid

    However, I do see my Redis instance being utilized, I suspect it may be a false error.

    1. Any thoughts on solving the error if it is a true error?
    2. Is there any way I can check if my setup is using Redis?

    Your help is much appreciated.

    Edit:
    I am using Predis.

    • This topic was modified 2 weeks ago by johnsyin97.
    • This topic was modified 2 weeks ago by johnsyin97.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Hey!

    I use Heroku myself. Can you post your diagnostics?

    Thread Starter johnsyin97

    (@johnsyin97)

    Status: Drop-in is invalid
    Client: Predis (v1.1.8)
    Drop-in: Invalid
    Disabled: No
    PhpRedis: Not loaded
    Predis: 1.1.8
    Credis: Not loaded
    PHP Version: 7.4.24
    Plugin Version: 2.0.21
    Redis Version: Unknown
    Multisite: No
    Metrics: Disabled
    Metrics recorded: null
    Filesystem: Could not initialize filesystem.
    WP_REDIS_DISABLED: false
    WP_REDIS_CLIENT: “predis”
    WP_REDIS_SCHEME: “redis”
    WP_REDIS_HOST: “<BLABLABLA>.compute-1.amazonaws.com”
    WP_REDIS_PORT: 13889
    WP_REDIS_MAXTTL: 2419200
    WP_REDIS_PASSWORD: ••••••••
    Drop-ins: [
    “Redis Object Cache Drop-In v2.0.21 by Till Krüss”
    ]

    Thread Starter johnsyin97

    (@johnsyin97)

    This is my composer json, I have dropin for this plugin

    {
      "name": "philippheuer/wordpress-heroku",
      "type": "project",
      "license": "MIT",
      "description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
      "homepage": "https://github.com/PhilippHeuer/wordpress-heroku",
      "keywords": [
    	"bedrock", "wordpress", "stack", "composer", "heroku", "wp"
      ],
      "config": {
    	"preferred-install": "dist",
    	"platform":{
    	  "php": "7.4.3",
    	  "ext-gettext": "5.5.4",
    	  "ext-imagick": "3.4.4"
    	}
      },
      "repositories": [
    	{
    	  "type": "composer",
    	  "url": "https://wpackagist.org"
    	}
      ],
      "minimum-stability": "stable",
      "require": {
    	"php": "^7.4",
    	"ext-gettext": "*",
    	"ext-gd": "*",
    	"ext-imagick": "*",
    	"ext-exif": "*",
    	"ext-mbstring": "*",
    	"composer/installers": "^1.10.0",
    	"vlucas/phpdotenv": "2.4.0",
    	"wp-cli/wp-cli" : "^2.5.0",
    	"oscarotero/env": "1.1.0",
    	"koodimonni/composer-dropin-installer": "^1.3.0",
    	"johnpbloch/wordpress": "^5.8.0",
    	"roots/wp-password-bcrypt": "^1.0.0",
    	"wpackagist-plugin/nginx-helper": "^2.2.2",
    	"humanmade/s3-uploads": "^3.0.3",
    	"wpackagist-plugin/debug-bar":"^1.1.2",
    	"wpackagist-theme/oceanwp":"^3.0.3",
    	"wpackagist-plugin/woocommerce":"^5.6.0-rc.2",
    	"wpackagist-plugin/elementor":"^3.4.0",
    	"wpackagist-plugin/elementskit-lite":"^2.3.5",
    	"wpackagist-plugin/woo-variation-swatches":"^1.1.17",
    	"wpackagist-plugin/woo-discount-rules":"^2.3.8",
    	"wpackagist-plugin/billplz-for-woocommerce":"^3.26.3",
    	"wpackagist-plugin/ocean-extra":"^1.7.8",
    	"wpackagist-plugin/wp-cerber":"^8.9.3",
    	"wpackagist-plugin/contact-form-7":"^5.4.2",
    	"wpackagist-plugin/post-smtp":"^2.0.23",
    	"wpackagist-plugin/ga-google-analytics":"^20210719",
    	"wpackagist-plugin/user-menus":"^1.2.7",
    	"wpackagist-plugin/cloudflare-flexible-ssl":"^1.3.1",
    	"wpackagist-plugin/wp-optimize":"^3.1.12",
    	"wpackagist-plugin/wordpress-seo":"^16.9",
    	"wpackagist-plugin/pixelyoursite":"^8.2.6",
    	"wpackagist-plugin/woo-advanced-shipment-tracking":"^3.2.8",
    	"wpackagist-plugin/flexible-shipping":"^4.7.2",
    	"cron/cron":"1.5.1",
    	"wpackagist-plugin/wp-fastest-cache":"0.9.4",
    	"wpackagist-plugin/redis-cache":"2.0.21",
    	"predis/predis": "1.1.8"
      },
      "require-dev": {
    	"heroku/heroku-buildpack-php": "*",
    	"squizlabs/php_codesniffer": "3.2.2"
      },
      "extra": {
    	"installer-paths": {
    	  "vendor/dumpster/": [
    	  ],
    	  "web/app/mu-plugins/{$name}/": [
    		"wpackagist-plugin/nginx-helper",
    		"wpackagist-plugin/wp-cerber",
    		"humanmade/s3-uploads"
    	  ],
    	  "web/app/plugins/{$name}/": [
    		"wpackagist-plugin/debug-bar",
    		"wpackagist-plugin/woocommerce",
    		"wpackagist-plugin/ocean-extra",
    		"wpackagist-plugin/elementor",
    		"wpackagist-plugin/elementskit-lite",
    		"wpackagist-plugin/woo-variation-swatches",
    		"wpackagist-plugin/woo-discount-rules",
    		"wpackagist-plugin/billplz-for-woocommerce",
    		"wpackagist-plugin/contact-form-7",
    		"wpackagist-plugin/post-smtp",
    		"wpackagist-plugin/ga-google-analytics",
    		"wpackagist-plugin/user-menus",
    		"wpackagist-plugin/cloudflare-flexible-ssl",
    		"wpackagist-plugin/wp-optimize",
    		"wpackagist-plugin/wordpress-seo",
    		"wpackagist-plugin/pixelyoursite",
    		"wpackagist-plugin/woo-advanced-shipment-tracking",
    		"wpackagist-plugin/flexible-shipping",
    		"wpackagist-plugin/wp-fastest-cache",
    		"wpackagist-plugin/redis-cache",
    		"predis/predis"
    	  ],
    	  "web/app/themes/{$name}/": [
    		"type:wordpress-theme",
    		"wpackagist-theme/oceanwp"
    	  ]
    	},
    	"dropin-paths": {
    	  "web/app": [
    		"package:wpackagist-plugin/redis-cache:includes/object-cache.php"
    	  ]
    	},
    	"wordpress-install-dir": "web/wp"
      },
      "scripts": {
        "post-install-cmd": [
            "rm -f -r ./web/wp/wp-content/themes/twentytwentyone",
            "rm -f -r ./web/wp/wp-content/themes/twentytwenty",
            "rm -f -r ./web/wp/wp-content/themes/twentynineteen",
            "rm -f -r ./web/wp/wp-content/themes/twentyseventeen"
        ],
    	"test": [
    	]
      }
    }
    Plugin Author Till Krüss

    (@tillkruess)

    Thanks for the details. The “Could not initialize filesystem.” is odd.

    Could you enable Metrics for an hour and see if Metrics recorded: null changes to a number?

    Thread Starter johnsyin97

    (@johnsyin97)

    How to enable metrics? My metrics page just show

    “not enough data collected, yet”

    Plugin Author Till Krüss

    (@tillkruess)

    Using heroku run bash, can you post the header of web/app/object-cache.php

    Thread Starter johnsyin97

    (@johnsyin97)

    Hi, I don’t have the capacity to do it this week, sorry. BTW, I just come to think of that, it may be because my deployment has set DISALLOW_FILE_MODS to true, as per https://github.com/PhilippHeuer/wordpress-heroku.

    I am worried that it can’t be changed for a heroku deployment so I never touched it.

    Plugin Author Till Krüss

    (@tillkruess)

    DISALLOW_FILE_MODS should work just fine. I’ll need to see the header that actually present on your Dyno to see what’s going on.

    Thread Starter johnsyin97

    (@johnsyin97)

    Is this it?

    <?php
    /**
     * Plugin Name: Redis Object Cache Drop-In
     * Plugin URI: http://wordpress.org/plugins/redis-cache/
     * Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Credis, H
    HVM, replication, clustering and WP-CLI.
     * Version: 2.0.21
     * Author: Till Kr<C3><BC>ss
     * Author URI: https://objectcache.pro
     * License: GPLv3
     * License URI: http://www.gnu.org/licenses/gpl-3.0.html
     *
     * @package Rhubarb\RedisCache
     */
    Plugin Author Till Krüss

    (@tillkruess)

    Odd. Did you happen to set any of the FS_* constants in your config, such as FS_METHOD?

    You can see them under “Tools > Site Health > Info > WordPress Constants”.

    Thread Starter johnsyin97

    (@johnsyin97)

    I don’t see any

    Plugin Author Till Krüss

    (@tillkruess)

    So we can be certain that the object-cache.php drop-in exists, but validate_object_cache_dropin() is returning false, likely because get_plugin_data() isn’t working properly in your setup.

    Since that’s a WordPress function I won’t try to work around it, try adding this filter to your WordPress setup:

    
    add_filter( 'redis_cache_validate_dropin', '__return_true' );
    

    This will skip the drop-in check and then let’s see if some metrics are recorded and the cache is filling up.

    Thread Starter johnsyin97

    (@johnsyin97)

    Guess it is working now, thank you so much

    Status: Connected
    Client: Predis (v1.1.8)
    Drop-in: Valid
    Disabled: No
    Ping: PONG
    Errors: []
    PhpRedis: Not loaded
    Predis: 1.1.8
    Credis: Not loaded
    PHP Version: 7.4.24
    Plugin Version: 2.0.21
    Redis Version: 6.2.3
    Multisite: No
    Metrics: Enabled
    Metrics recorded: 0
    Filesystem: Could not initialize filesystem.
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_DISABLED: false
    WP_REDIS_CLIENT: "predis"
Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.