0

I've following two path

path1- test/hello/hello.php

path2- test/hello1/hello1.php //notice the one in the directory after test/

hello.php

<?php    
session_start();
$_SESSION['name1'] = 'abcd1';    
?>

other file is

hello1.php

<?php
session_start();
echo $_SESSION['name1'];
?>

In one computer I am able to get the value in hello1.php In another computer I am not getting value in hello.php

In both the PC I had clear storage, ran Hello.php for session to set. Hello1 has value in One pc , in another I don't have value.

What might be the issue?

Also, what is the correct work, In general will I get session value Outside test folder OR everywhere inside test folder or only in the parent directory of the file where session was created. Please don't forget the original issue. Also one comment I don't know if its realated, I have 2 xampp in 2 drive in the pc where hello1.php gave the value. does'nt it affect anything?

In short I want concept of Session WRT to directories/ also about framework, does framework make restrictions to accessing variable outside their core project folder.

BILAL MALIK
  • 141
  • 1
  • 15

2 Answers2

0

You told us nothing about how your PHP is configured, so there is a very extensive list of things which could be going wrong - far too many to list here. Make sure your error reporting/logging is working correctly (and that no errors or warnings are being produced). Have a look at the path, name and value of the cookies being emitted by the server for both pages using firebug or developer tools.

symcbean
  • 47,736
  • 6
  • 59
  • 94
0

Sessions are preserved across requests and use cookies set on the browser to access the data. Your computers have different cookies, and thusly different sessions.

Read more about this in another answer

Ultimately you need to think about if you are using the right tools to accomplish this goal.

infamoustrey
  • 730
  • 8
  • 16
  • I'm using simple Xamp with php 7.3. program is very simple... Should the file 2 return output despite being in another directory but in one parent directory? – BILAL MALIK Mar 25 '19 at 05:12