PHPSESSID
is blank when I
echo $PHPSESSID
But in php.ini
file I have added
session.name = PHPSESSID
I am using PHP 5.4.35
.What is the problem here?
PHPSESSID
is blank when I
echo $PHPSESSID
But in php.ini
file I have added
session.name = PHPSESSID
I am using PHP 5.4.35
.What is the problem here?
You should use $_COOKIE['PHPSESSID']
, for example:
session_start();
echo session_id();
print $_COOKIE['PHPSESSID'];
will print you Session's ID twice, one by echo session_id();
and second by print $_COOKIE['PHPSESSID'];
Use the session_id
function. This retrieves the value of the session id regardless of the name that was used to create the session (cookie or otherwise).
If you are interested in getting the name, you could use use ini_get("session.name")
.
$PHPSESSID
is not correct. PHPSESSID
is an index of array $_COOKIE[]
. Example:
echo $_COOKIE["PHPSESSID"];
This cookie starts when you start a session.