Jump to content

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 = 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

 

 

 

 

Is there any chance that you are overlooking a character out of place in your real code? If we can look at it, we might be able to point out a mistake. I guess if it works on your home server, then there's really no reason it shouldn't work on the hosted server. I would do a little more testing, and then switch hosts. You shouldn't have to deal with irritating stuff like this.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.