0

First off, I am new here and I don't know how to format my post nicely. Apologies.
My script starts with

<?php 
 if (!isset($_SESSION)) {
 session_start();
 }
 ini_set('soap.wsdl_cache_dir', "/tmp/");
?>

The form posts onto itself

form action = \"index.php\" method = \"POST\"

While debugging I noticed that after every postback, the session id changes and I understand that it should't. There are no session_destroy() calls or other session_start() function calls in the script. I'm unsure what additional information you need but I'm sure you'll let me know. Thanks in advance!

EDIT Here is the session section of the php_info()

sessionSettings

3
  • Did you try removing the if around session_start?
    – somedev
    Commented Jun 6, 2013 at 16:37
  • check the session cookie settings. they may be too restrictive, causing you to "lose" the session on each request (php.net/manual/en/function.session-set-cookie-params.php)
    – Marc B
    Commented Jun 6, 2013 at 16:45
  • Is echo session_id(); and checking to make sure it stays the same after each postback a valid way to test this?
    – spence0021
    Commented Jun 6, 2013 at 17:40

1 Answer 1

2

try changing this:

if (!isset($_SESSION)) {
 session_start();
 }

into this:

 session_start();
3
  • That's how I had it before and I had the same problem. I added the if statement on suggestion from somebody and it didn't seem to make a difference.
    – spence0021
    Commented Jun 6, 2013 at 17:22
  • then it might be something with your cookies settings in your php.ini, can you update your question with the relevant part of that file so that we can have a look there?
    – Julien
    Commented Jun 6, 2013 at 17:54
  • well i've compared it to the setup of the box i'm currently on and i see a few differences, these are my settings that differ from yours, so try to play around with those and see if it fixes your problem: session.gc_probability 1 1 session.save_handler file file session.use_only_cookies off off let us know how it goes :)
    – Julien
    Commented Jun 6, 2013 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.