Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Object Cache Pro for WordPress Doc Update #9206

Closed
RayHollister opened this issue Sep 5, 2024 · 12 comments
Closed

Enable Object Cache Pro for WordPress Doc Update #9206

RayHollister opened this issue Sep 5, 2024 · 12 comments
Assignees
Labels
Topic: Caching Caching related issues at the CDN or CMS level Topic: Code Structure Related to Upstreams and other code structure details Topic: WordPress WordPress-specific

Comments

@RayHollister
Copy link

Re: Enable Object Cache Pro for WordPress

Priority: Medium (choose one, remove the other options)

Issue Description:

Instructions are woefully out of date. None of them work.

Suggested Resolution

Go through the whole page and rewrite it. The most heinous part is "config/application.php". That file does not exist.

@rachelwhitton
Copy link
Member

Hi @RayHollister thanks for opening this issue. I just want to make sure, are you able to successfully set up Object Cache Pro following the non-composer steps here? config/application.php is only applicable to composer managed WordPress sites

@rachelwhitton rachelwhitton self-assigned this Sep 11, 2024
@rachelwhitton rachelwhitton added Topic: WordPress WordPress-specific Topic: Code Structure Related to Upstreams and other code structure details labels Sep 11, 2024
@RayHollister
Copy link
Author

No, when I followed the Non-Composer section instructions, it did not set up correctly. I was only able to get it working using a combination of some of the steps in the Non-Composer section and adaptations of the steps in the Composer-Managed section. Unfortunately I did not document what it took to get it working. I kind of had to poke around and try things until it worked correctly. Also unfortunately, I am still unable to get it working correctly on Lando. In order to develop locally I have to delete the object-cache.php drop-in file and restore it before I push my changes.

@rachelwhitton rachelwhitton added the Topic: Caching Caching related issues at the CDN or CMS level label Sep 12, 2024
@jazzsequence
Copy link
Contributor

jazzsequence commented Sep 12, 2024

@RayHollister Can you share what failed when you tried to use the Terminus command? Was there an error that was visible in the Workflow Log? Did you previously or do you currently have other object cache plugins installed (like WP Redis)?

The Composer instructions are specifically for sites using the WordPress (Composer Managed) Bedrock-based upstream. The files and functions that you refer to are unique to Bedrock-based WordPress sites. See: https://roots.io/bedrock/docs/configuration/

cc @scottbuscemi @pwtyler

@jazzsequence
Copy link
Contributor

Todo:

  • Write a "manual" installation workflow
  • Suggest Pantheon Secrets as a method for storing and fetching the API key

@RayHollister
Copy link
Author

RayHollister commented Nov 14, 2024

OK, I just went through the process again, and here's my experience.

I went through all of the instructions on Enable Object Cache Pro for WordPress through line 6c of Installation and Configuration for non-Composer WordPress Sites

It worked fine on the multidev server, but when I pulled it to my local Lando server, it will only gives me the error: "Error establishing a Redis connection" on the browser.
And I get this in the terminal:

objectcache.critical: Failed to initialize object cache: PhpRedis was not compiled with igbinary support. 'For more information about enabling serializers see: https://objectcache.pro/docs/data-encoding/'
Error: Error establishing a Redis connection.

If I shut down the Lando server down and restart it, I just get [500] [ECONNREFUSED] unless I delete the /plugins/object-cache-pro/ folder.

@pwtyler
Copy link
Member

pwtyler commented Nov 15, 2024

I've never successfully enabled Redis in Lando, can you try adding to your wp-config.php? This should prevent it from trying to initialize while running locally.

if ( isset( $_ENV['LANDO'] ) && 'ON' === $_ENV['LANDO'] ) {
  define('WP_REDIS_DISABLED', true);
}

https://objectcache.pro/docs/configuration

@RayHollister
Copy link
Author

RayHollister commented Nov 15, 2024

@pwtyler

I was literally in the middle of doing that when I got the notification from GitHub. 🤣 I'll let you know if it works.

@RayHollister
Copy link
Author

@pwtyler OMG FINALLY! I can work on my Lando servers again!

I guess I don't really need Redis on my Lando servers. 🤷🏻‍♂️

But since Lando includes Redis support I just assumed I was doing something wrong.

I'm gonna test it on another Lando, and if it works, I'll submit it as a recommended edit and close out this issue.

@RayHollister
Copy link
Author

Done and Done. Tested it on three broken and sad Landos on my computer. Submitted Pull Request #9309

@pwtyler
Copy link
Member

pwtyler commented Nov 15, 2024

Ah, I just re-read your error! Using a similar pattern, try setting serializer to php instead, if you can't get igbinary support setup in Lando.

$serializer = "igbinary";
if ( isset( $_ENV['LANDO'] ) && 'ON' === $_ENV['LANDO'] ) {
  $serializer = "php";
}

....
// Within WP_REDIS_CONFIG...
  'serializer' => $serializer,

https://objectcache.pro/docs/configuration-options#serializer

@RayHollister
Copy link
Author

RayHollister commented Nov 15, 2024

@pwtyler No luck. It just kept giving me [500] [ECONNREFUSED]

Got this in lando logs:

NOTICE: PHP message: objectcache.critical: Failed to initialize object cache: PhpRedis was not compiled with Zstandard compression support, see For more information about enabling compressions see: https://objectcache.pro/docs/data-encoding/

RayHollister added a commit to RayHollister/documentation that referenced this issue Nov 15, 2024
Wow, good catch. I have no idea where that code snippet came from. I literally copied and pasted from your comment in pantheon-systems#9206

Co-authored-by: Phil Tyler <[email protected]>
@pwtyler
Copy link
Member

pwtyler commented Nov 18, 2024

Different error at least, similar, may be able to adjust the compression setting to something that is supported by Lando's version of PHP

https://objectcache.pro/docs/configuration-options#compression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic: Caching Caching related issues at the CDN or CMS level Topic: Code Structure Related to Upstreams and other code structure details Topic: WordPress WordPress-specific
Projects
None yet
Development

No branches or pull requests

4 participants