I have an issue with $_SESSION
global across a single domian, on my local machine, running PHP 5.1 build 2600
I'm creating a session in the domain root.
$first_name='martin';
$second_name='thorburn';
$login_array=array("first_namet"=>$first, "second_name"=>$second);
$_SESSION['login']=$login_array;
When I run print_r($_SESSION['login']);
in the root, I get the expected response "Array ( [first_name] => martin [second-name] => Thorburn )
However, when I run the same print_r($_SESSION['login']);
in any sub-folder I get an error Notice: Undefined index: login in subfolder\test.php on line 3.
I have ensured that session_start()
is the first line of code in every file, and I ensured all my links and redirects go to the same WWW DOMAIN
Additionally when I run phpinfo()
the following is set:
session.cookie_domain //local value= / master value= /
session.cookie_path //local value= / master value= /
session.save_path //local value= localdrive\htdocs\session master value= localdrive\htdocs\session\ (this is outside of the root).
Can anyone help me with a configuration that will allow the session to be used in any sub-folder from which it was created?
Many thanks for your help.