0

I'm trying a sample on php using:

<?php
  $_SESSION["color"] = "blue";
  echo $_SESSION["color"] . ".<br>";
?>

When I refresh the page, blue is printed but there are no cookies associated with the page I loaded, checking using "Developer Tools". How does the server track my session ID if there are no cookies?

Jonny Henly
  • 4,023
  • 4
  • 26
  • 43
another q
  • 21
  • 4
  • Possible duplicate of [Where are $\_SESSION variables stored?](http://stackoverflow.com/questions/454635/where-are-session-variables-stored) – Jonny Henly May 02 '16 at 03:20

1 Answers1

1

There is a cookie. It's called Session ID. Session ID is a randomly generated string that's given to the client (browser).

The data you assign to a session is stored on server identifiable by session ID.

If you're seeing no cookie stored in your browser, there can be two possibilities:

  1. You're not making a call to session_start in your PHP script which is necessary to do at the very beginning of the script.
  2. The browser is not letting cookies to be stored.
Javid
  • 2,755
  • 2
  • 33
  • 60