title: PHP Session ID changing on every request
body: <p>I have just migrated my application from a local WAMP to the actual online server. This has caused trouble with the session ID not being saved as it appears.</p>
  
  <ul>
  <li>I have checked for unwanted characters being outputted before session_start</li>
  <li>I can't seem to find any session file being saved in my /tmp</li>
  </ul>
  
  <p>These are my session settings:</p>
  
  <pre><code>session.auto_start  Off Off
  session.bug_compat_42   Off Off
  session.bug_compat_warn On  On
  session.cache_expire    180 180
  session.cache_limiter   nocache nocache
  session.cookie_domain   no value    no value
  session.cookie_httponly Off Off
  session.cookie_lifetime 0   0
  session.cookie_path /   /
  session.cookie_secure   Off Off
  session.entropy_file    no value    no value
  session.entropy_length  0   0
  session.gc_divisor  1000    1000
  session.gc_maxlifetime  1440    1440
  session.gc_probability  1   1
  session.hash_bits_per_character 5   5
  session.hash_function   0   0
  session.name    PHPSESSID   PHPSESSID
  session.referer_check   no value    no value
  session.save_handler    files   files
  session.save_path   /tmp    /tmp
  session.serialize_handler   php php
  session.use_cookies On  On
  session.use_only_cookies    On  On
  session.use_trans_sid   0   0
  </code></pre>
  
  <ul>
  <li>The online server is running: PHP Version 5.3.9 while the WAMP is: PHP Version 5.3.5.</li>
  <li>By viewing the headers sent and the response in every page load I got the following, the set-cookie sends the appropriate session id and the response received sends a new one as if nothing was requested.</li>
  <li>I am running the site on a preview URL (SSL on). I don't know if this has anything to do, my domain is not registered yet.</li>
  <li><p>Error code is as simple as:</p>
  
  <p><code>$sId = session_id();</code></p>
  
  <p><code>if ($sId == '') { session_start(); }</code></p></li>
  </ul>