Session variables
Posted: Wed Feb 25, 2004 2:59 pm
Hi,
I'm trying to get session variables working. I have a local (development) version of my site on win2k/apache/php4x/mysql. The remote site uses Linux/apache/php4x/mysql. Ok, I am going through a tutorial from Devshed which supplies this code (which I'm using to test my setup):
<?
session_start();
session_register("SESSION");
if (! isset($SESSION)) {
$SESSION["count"] = 0;
echo "<li>Counter initialized, please reload this page to see it increment";
} else {
echo "<li>Waking up session $PHPSESSID";
$SESSION["count"]++;
}
echo "<li>The counter is now $SESSION[count] ";
?>
Simple enough piece of code! It adds one to the variable on refreshing the page and displays the new value each time. Works fine remotely, but not locally. No error message locally either. Keeps printing the value of $SESSION[count] as zero. Don't get the 'waking up session...' echoing either. I did a side by side comparison with phpinfo() on both servers. Both match in all the [session] settings. Any idea what could be wrong locally?
I'm trying to get session variables working. I have a local (development) version of my site on win2k/apache/php4x/mysql. The remote site uses Linux/apache/php4x/mysql. Ok, I am going through a tutorial from Devshed which supplies this code (which I'm using to test my setup):
<?
session_start();
session_register("SESSION");
if (! isset($SESSION)) {
$SESSION["count"] = 0;
echo "<li>Counter initialized, please reload this page to see it increment";
} else {
echo "<li>Waking up session $PHPSESSID";
$SESSION["count"]++;
}
echo "<li>The counter is now $SESSION[count] ";
?>
Simple enough piece of code! It adds one to the variable on refreshing the page and displays the new value each time. Works fine remotely, but not locally. No error message locally either. Keeps printing the value of $SESSION[count] as zero. Don't get the 'waking up session...' echoing either. I did a side by side comparison with phpinfo() on both servers. Both match in all the [session] settings. Any idea what could be wrong locally?