PHP SESSION works only over HTTPS + PHPSESSID cookie is not sent -
i have sample page content of next code:
<?php session_start(); if (isset($_session['test'])){ echo 'session variable set '; echo $_session['test']; }else{ echo 'session variable not set'; $_session['test'] = 'test'; }
when access page through https (ex: https://www.example.com/page.php) works well, first time sets $_session variable , after retrievs normally.
however, when access page through normal http, every time "session variable not set". when checked request/response cookies in both situations, found when using https phpsessid cookie retrieved first request of page, , sec request on same phpsessid sent request cookie. however, on normal http every time load page, loads without sending cookies, gets different phpsessid cookie doesn't save , utilize next requests of page.
i want know causes , solutions problem.
thank you.
session cookies may sets secured
try using session_set_cookie_params disable secure session cookies
$oldparams = session_get_cookie_params(); session_set_cookie_params($oldparams["lifetime"], $oldparams["path"], $oldparams["domain"], false, true); session_start();
php session cookies
No comments:
Post a Comment