tags:

views:

27

answers:

2

I have a very simple test page for PHP session.

<?php
session_start();

if (isset($_SESSIONS['views']))
{
    $_SESSIONS['views'] = $_SESSIONS['pv'] + 1;
}
else
{
    $_SESSIONS['views'] = 0;
}

var_dump($_SESSIONS);

?>

After refreshing the page, it always show

array
  'views' => int 0

The environment is XAMPP 1.7.3. I checked phpInfo(). The session is enabled.

Session Support     enabled
Registered save handlers    files user sqlite
Registered serializer handlers  php php_binary wddx

Directive   Local Value Master Value
session.auto_start  Off Off
session.bug_compat_42   On  On

When the page is accessed, there is session file sess_lnrk7ttpai8187v9q6iok74p20 created in my "D:\xampp\tmp" folder. But the content is empty.

With Firebug, I can see cookies about the session.

Cookie  PHPSESSID=lnrk7ttpai8187v9q6iok74p20

It seems session data is not flushed to files.

Is there any way or direction to trouble shoot this issue?

Thanks.

+1  A: 

BTW, it is $_SESSION not $_SESSIONS.

Hence why it isn't saving the data.

Chacha102
+1  A: 

The variable you need to set is called $_SESSION not $_SESSIONS

nickf
Beat you by 7 seconds. :)
Chacha102
noooooooooooooo
nickf