Hi all,
I have two PHP files, one in root and the other in a folder called admin.
If I set $_SESSION in a file in the admin folder and then view $_SESSION in any other file within the admin folder, everything is OK.
However, if I then go to a file in root $_SESSION is blank, and it is blank if I then go back to a file in admin.
This problem only exists on my hosting and doesn't happen on a local dev machine. I've compared the php.ini session settings and there both the same.
Any ideas?
Files
admin/test.php
<?php
session_start();
if( empty($_SESSION) ) {
echo "Session not set<br />";
$_SESSION['test'] = "test";
}
echo "<pre>";var_dump($_SESSION);echo "</pre>";
/test.php
<?php
session_start();
echo "<pre>";var_dump($_SESSION);echo "</pre>";