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

I'm not sure what I have to do to get the plugin working #248

Open
maxacarvalho opened this issue Apr 28, 2023 · 3 comments
Open

I'm not sure what I have to do to get the plugin working #248

maxacarvalho opened this issue Apr 28, 2023 · 3 comments

Comments

@maxacarvalho
Copy link

Hi,

I installed the plugin on a fresh (latest) WordPress installation. I can see that the table wp_pantheon_sessions was created successfully. But no entries are being added to that table.
I don't see anything listed under the Tools > Sessions area.

As I mentioned, this is a fresh WordPress installation.
The only other plugin that I added so far is the Send E-mails with Mandrill, one which is only a way to send emails using Mandrill by MailChimp.

I wonder if there's any extra step that I have to take, perhaps some PHP configuration that's necessary?

I'm using:

  • WordPress version: 6.2
  • Native PHP Sessions for WordPress version: 1.3.5
  • PHP version 8.1.18
  • MySQL 8
  • Nginx

Thank you.

@jazzsequence
Copy link
Contributor

@maxacarvalho
I guess I would ask how you are using sessions in your codebase? As noted in the plugin's description, the intent is to allow native handling of PHP's $_SESSION global which is otherwise unavailable in WordPress. If you aren't using $_SESSION then it's not going to look like it's doing anything.

@maxacarvalho
Copy link
Author

Hi @jazzsequence
Thanks for your reply. To be honest, I don't know how to make that happen using WordPress.
I'm 100% comfortable with PHP. I have been using it for more than ten years. But when it comes to WordPress, I'm useless. This is a project that I put together for a client that needs WordPress.
Since our setup uses Kubernetes, it's possible that each deployment drops all user sessions since WordPress (weirdly enough) offers only file-based sessions natively. For that reason, I'm trying to move those sessions to long-living storage.

I chose the database since the website doesn't have heavy traffic; otherwise, I'd go for something faster like Redis.
Your plugin is the only option that I could find for WordPress DB sessions, another fact that I find very odd since that's a very common approach.

I'm sorry to give you such a long response, but I just wanted to give you a full context instead of just saying, "I don't know how to get the $_SESSION to be global when it comes to WordPress".

@jazzsequence
Copy link
Contributor

WordPress is indeed weird when it comes to session handling which is why this plugin exists. The configuration and usage is described in the readme -- after installing and activating the plugin, native PHP sessions should Just Work™️. If you're seeing errors or evidence that sessions aren't being stored and recovered properly, then that would be something for us to dig into. After activating this plugin (or loading it as an mu-plugin) all your previous PHP experience in session handling should all be applicable and it should behave the way you expect.

I apologize if I'm stating the obvious but without any specific errors or reproducible steps it's difficult to say what you're doing "wrong". I will say that I would not be surprised by sessions clearing after a deployment, but I do think that that would be a case that would be handled by the plugin (since the sessions are stored in the database).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants