andrewb
Mar 9th, 2007, 10:05 PM
Hi Folks,
I am tearing my hair out trying to get sessions to work, I've tried the simple example code below to test whether sessions were working as they're meant to.
<?php
session_start();
$count = $_SESSION["counter"] + 1;
$_SESSION["counter"] = $count;
echo $_SESSION["counter"]." / ".session_id();
?>
Everytime I run this page, the counter does not increment and the session ID changes (and it is writing session files to the temp folder, with every pageview). Any ideas? My session variables in PHP.INI are as follows (I've not included the commented out variables):
session.save_handler = files
session.save_path = "C:\Temp"
session.use_cookies = 0
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = \
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
I am tearing my hair out trying to get sessions to work, I've tried the simple example code below to test whether sessions were working as they're meant to.
<?php
session_start();
$count = $_SESSION["counter"] + 1;
$_SESSION["counter"] = $count;
echo $_SESSION["counter"]." / ".session_id();
?>
Everytime I run this page, the counter does not increment and the session ID changes (and it is writing session files to the temp folder, with every pageview). Any ideas? My session variables in PHP.INI are as follows (I've not included the commented out variables):
session.save_handler = files
session.save_path = "C:\Temp"
session.use_cookies = 0
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = \
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5