Jump to content

$_SESSION gets lost


bpz
 Share

Recommended Posts

Hi,

new forum look, cool haha!

Look, I'm trying to use Securimage capcha in a template. The SESSION vars that the capcha image sets get lost somewhere in processwire. The API page says that this superglobal is always available. Do you have any hints where $_SESSION may be reset?

Thanks ???

Link to comment
Share on other sites

Solved myself. PW stores session in its own directory ini_set("session.save_path", rtrim($config->paths->sessions, '/'));

I made the capcha use the same session path and it now works.

Link to comment
Share on other sites

Thanks for reporting back, glad you got this figured out. I was just going to reply that I had no idea :) because PW does not touch PHP's $_SESSION var, other than adding a key to it for PW's session data.

Link to comment
Share on other sites

  • 1 year later...

I'm facing the same issue.

But, if I also want "Securimage" use the same session path as "Processwire", where do I put this code?

ini_set("session.save_path", "/home/www/****/site/assets/sessions");

And what else do I need to do exactly?

Thanks in advance

Link to comment
Share on other sites

It sounds like Securimage must try to set it's own session path? I don't know enough about Securimage to say where you'd place that, but the first place I would look is in any config/settings file that comes with that software. If there's nothing to be found there, perhaps you can just add the line to the top of its index.php or whatever php file initializes it. 

Link to comment
Share on other sites

  • 1 year later...

I'm posting a solution to this for anyone who finds this topic through google:

There are two steps required to make Securimage work with ProcessWire:

1. Add this code to the top of securimage.php

ini_set("session.save_path", $_SERVER['DOCUMENT_ROOT'] . "/site/assets/sessions/");

Of course, the path may change depending on where your session path is.  This works for those of us with the default path.

2. Change public $session_name on line 382 from null to "wire".

This will ensure that Securimage will validate properly.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

I've encountered the same issue with the latest version of Securimage and PW 3.0.61. I have Securimage woking without any issue on most of my other non-cms websites.

I've made the changes to the securimage.php as suggested by jamesmarshall. That has not worked. Are there other steps that need to be taken such as adding

Would it be possible for someone to share the steps taken to get Securimage working?

Any help would be appreciated.

Link to comment
Share on other sites

  • 1 month later...

I think i may have a similar problem, i currently have two websites running on the same server but under different subdomains, i have user data that needs to persist across subdomains, i'm using PHP's $_SESSION variable to store the data on the non ProcessWire site, though when i attempt to access the variables in PW they don't show up.

I've got the ini_set('session.cookie_domain', '.example.com'); and i can see the PHPSESSID cookie does show up for both subdomains.

However in PW when i echo session_id() it displays the session id from the wire cookie. So i guess $_SESSION variable has been taken over by that?

Is there a way to still access the original $_SESSION variables from PHPSESSID ?

Any help on this would be great.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...