Jump to content

Php Session Problem


sunwukung

Recommended Posts

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 = Offsession.gc_divisor: Host = 100 Local = 1000session.hash_bits_per_character: Host = 4 Local = 5session.save_path: Host = No value Local = C:/Program Files/wamp/tmp

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...