I’m currently facing a strange problem in PHP.
I have two scripts, index.php which is the “homepage”, and ajax.php which is a script called by an AJAX request.
index.php
session_start();
if ($_SESSION['test'] == "hello") {
$_SESSION['test'] = "bleh";
die();
}
echo "here";
ajax.php
session_start();
$_SESSION['test'] = "hello";
So I go on index.php, then make an ajax call on ajax.php, I refresh index.php, and I actually expected to have a blank page, then refresh and have “here” printed; but actually the script never dies, like if $_SESSION[‘test’] had never been set to “hello”.
Any ideas? Thanks.
I tried this at my system and it works as expected. Try calling the ajax.php page directly and see if you get the expected result, and then call the first one.
Also see if your browser get a cookie set and make sure it is not ignored so you get a new session every time the session starts.