Jump to content

sunwukung

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Everything posted by sunwukung

  1. Hi I'm having a problem with my sessions. When developing locally, my scripts work fine - but on the server they aren't passing the session data correctly. I'm having to use ini_set to save cookies in a specific directory on the host. When I move to the second script, using a header:Location protocol - it generates a new session that is empty. In a nutshell: //script1......................... ini_set('session.save_path','./session/'); session_start(); $_SESSION['message'] = 'blah'; Then on another page ini_set('session.save_path','./session/'); session_start(); if (isset($_SESSION['message']) { $msg = $_SESSION['message']; echo "$msg"; } else { echo "**** GRRRRRRR!!! AAAAAAAGHG!! the sessions still not working...."; } I've taken a look at using session_name, but while I can figure out how to derive or retrieve a session_name (or session_id), I can't figure out how to force the second script to access the session I want.
  2. Problem solved: i've used use ini_set to change the session.save_path
  3. Sorry, that was a typo when writing the question for this forum: Anything else?
  4. Hi, can any of you help me with this problem? I have recently moved to Linux hosting, but develop locally using WAMP. I'm having trouble trying to replicate session behaviour on my host - namely the session cookie appears to be empty when I leave one page and move to the next. For example - I set the session variable thus: session_start; $user_input='blah'; $_SESSION['data']=$user_input; and then on the next page I use the following: session_start; if ($_SESSION['data']=='blah'){ $x=$_SESSION['data']; echo "$x";} else { echo "errors"; } This is actually a much simpler description of what I'm doing - but in essence it's the same. When I test this locally I get the expected result - in this example the text 'blah' in the browser. However, when I test on the host, I get the error message. I did a print_r() of the $_SESSION variable on each location, and locally it reads out the content of the variable, but on the host the variable is empty once it is picked up by the recieving page. I've contacted my host, but they suggested that this might be down to the dev environment, specifically the variable 'path' on account of my local setup being windows, and the host being Linux. I checked the settings with phpinfo() on both environments, and under the session section there are the following differences: session.bug_compat_42: Host = On Local = Off session.gc_divisor: Host = 100 Local = 1000 session.hash_bits_per_character: Host = 4 Local = 5 session.save_path: Host = No value Local = C:/Program Files/wamp/tmp
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.