Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

session_start() required for reading $_SESSION

Let's say we have index.php which calls session_start() and populates $_SESSION data.
While the user is on the webpage, they click a button and an AJAX query is kicked off to ajax.php . ajax.php does not call session_start(), but it is successfully reading the data in $_SESSION.

Is this expected behavior?

like image 559
davidkomer Avatar asked May 29 '13 05:05

davidkomer


1 Answers

If you look at the output of a phpinfo(); call you will probably notice that the session.auto_start configuration variable is set to 1.

See documentation for further reference. Unless this flag is set it is definitely not expected behaviour, and you are probably including code somewhere that explicitly invokes session_start().

like image 52
Niels Keurentjes Avatar answered Oct 27 '22 21:10

Niels Keurentjes