What it's happening is something really strange. The defined path to save my session ID's was this (XAMPP did it automatically):
session.save_path = "D:/XAMPP/tmp"
This doesn't seem to have much importance, as sessions fail whatever the save_path is.
The thing is that when I start a session from for instance page1.php, a file containing the session ID is created in the save_path directory. Next, I call page2.php from page1.php and I try to recover the session variable I created in page1.php. Well...surprisingly, PHP creates another file with no content, instead of reading the values within the first ID file, or cookie, if I can call it like this. As a result, page2.php can't read the session variable and it is not echoed on screen.
I've asked on many forums, and the config. of my php.ini seems to be ok. So I started to think it XAMPP has anything to do with this. What do you think? Have anyone ever experienced problems with sessions by using XAMPP? Couls you please help me out to solve this?
page1.php:
- Code: Select all
<?php
session_start();
$_SESSION['varSession'] = "Hello world!";
echo 'Content of $_SESSION[\'varSession\'] is: '.$_SESSION["varSession"].'<br />';
?>
<a href="page2.php">Next page</a>
page2.php:
- Code: Select all
<?php
session_start();
echo 'Content of $_SESSION[\'varSession\'] is: '.$_SESSION["varSession"].'<br />';
unset($_SESSION['varSession']);
session_destroy();
?>
section sessions in phpinfo():
- Code: Select all
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
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 4 4
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path D:\xampp\tmp D:\xampp\tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0
Best regards!