Search code examples
phpsessionsession-cookiesopayo

Is it possible that PHP session expire while surfing website using IP address?


One unexpected issue I faced recently was that I had Sagepay payment gateway configured on one of my site and it was working pretty straight. But when I moved the whole site to another server, I had to test the site using its IP address:

http://xxx.xxx.xxx.xxx/mywebsite/

Now when we complete online payment on site through Sagepay payment gateway,

  1. It returns back to the site
  2. Fetches customer details from Session
  3. Sends an email to the customer

So now (in 3rd step), when it went to fetch Customer Email from session, it didn't get any value. I tried to dump the $_SESSION array and it was blank.

So my question is: Is it possible that Sessions expire while surfing website through IP address?


Solution

  • Yes... Sessions can be purged regularly if they fall within the limits... read here... also has hints on how to modify settings to suit you're needs: http://php.net/manual/en/function.session-cache-expire.php it details how PHP cleans up sessions which is most likely what is happening.