• Resolved mwenner

    (@mwenner)


    We have installed the Age Gate plugin (https://www.ads-software.com/plugins/age-gate/). We don’t actually gather the person’s age, but make sure they click the ‘Yes’ button to confirm that they are an investment advisor and can access our site. If they are, we let them into the site. The functionality seems to be working fine, but we are getting an error in our log (see below). We have the native sessions plugin installed in the mu folder and called from pantheon.php. Do you have any thoughts on what could be causing this error?

    session_start(): Failed to initialize storage module: user (path: )wp-content/plugins/age-gate/public/class-age-gate-public.php:633

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @mwenner,

    I’ve not seen this before, but I found this on a drupal forum, so I’d imagine the issue is similar here:

    Because of the way Pantheon works, it requires sessions be saved as a file that can be used by any “server” processing the PHP. This is an easy fix. Just add ini_set('session.save_handler', 'files'); before session_start(); so it looks like…

    ini_set('session.save_handler', 'files'); 
    session_start();

    A couple of things you can try:
    Switch to the JS “Cache bypass” version as that uses cookies rather than native sessions, or, you could try the V2 that’s in development. It is fairly stable just not an official release just yet. That removes sessions all together in favour of cookies in both the PHP and JS implementations.

    You can get an alpha version here

    Thanks
    Phil

    Thread Starter mwenner

    (@mwenner)

    We are a little hesitant to install the Alpha version and before adding in code, we did some additional troubleshooting and the error seems to only come up when we clear the site cache through the Pantheon dashboard, not when the plugin itself is trying to write to a specific path. We checked with Pantheon support on this and they included the below response. Can you review and let me know if this makes sense and let us know your thoughts?

    ————————————————————————————————————
    Customer: Pantheon Helpdesk
    Subject: error with Age Gate plugin
    ————————————————————————————————————

    Dustin LeBlanc | FEB 27, 2018 | 11:28AM PST

    Hi Matthew!

    I don’t see Gaya’s email showing up as CC’d, perhaps you bcc’d her?

    In regards to the issue, it’s interesting that you only see it after cache clears. Typically when you get this error, it’s related to a session being instantiated outside a WordPress bootstrap (see https://silvermapleweb.com/using-the-php-session-in-wordpress/). I don’t see a Redis cache here, so when you flush the cache, the only that should change is the page cache is cleared, which shouldn’t touch this at all. I do see this showing up in the error logs:

    bc.. Warning: session_start(): user session functions not defined in /srv/bindings/04ef30be1e5944b8b36bb1cddbacaf61/code/wp-content/plugins/age-gate/public/class-age-gate-public.php on line 633
    Fatal error: session_start(): Failed to initialize storage module: user (path: ) in /srv/bindings/04ef30be1e5944b8b36bb1cddbacaf61/code/wp-content/plugins/age-gate/public/class-age-gate-public.php

    p. Looking at the code, they wrapped that in a class method called @start_ag_session()@ which seems good, but I have no idea how that code is getting called during the cache clear, but it appears it is.

    Unfortunately, this might require some debugging of the plugin code itself, I’d recommend filing an issue with the plugin maintainer and letting them know that this is getting triggered by WP_CLI cache clear runs.

    Plugin Author Phil

    (@philsbury)

    Completely understand not wanting to use the alpha, even a beta I’d probably not want to try use in production.

    Thanks for the info on this, I think the key could well be the last part about running from WP CLI.

    I’ve added to the start session method to essentially do nothing if it’s CLI, would you be able to try the version here: https://www.dropbox.com/s/nebcgcwh88fhjte/age-gate-1.5.2-rc.zip?dl=0 – there’s no breaking changes in this so will be fine to use. If all is good I’ll reply to the WP repo.

    Thanks,
    Phil

    Thread Starter mwenner

    (@mwenner)

    We’ve tried the version from dropbox and the error is no longer showing up for us when clearing the cache via the Pantheon dashboard. Thank you for your prompt attention in this matter.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘session_start(): Failed to initialize storage module: user (path: )’ is closed to new replies.