Setting session cookie parameters

I am trying to set the session cookie parameters by using session_set_cookie_params() and calling it before session_start()…I set the secure option to TRUE.
But as I see in the dev tools of chrome this has no effect whatsoever.

I made the test in a local machine,so by definition HTTPS was not running.

So could be this cause for session_set_cookie not having any effect?
I mean that HTTPS must be present.

You really should get in the habit of reading the documentation.

It is your friend.

http://php.net/manual/en/function.session-set-cookie-params.php

secure
If TRUE cookie will only be sent over secure connections.

Ok…I understand now better.Here is the problem now…according to the manual, if I refresh the page where session_set_cookie_parameters is set the cookie will not be sent cause localhost is NOT secure connection.

Am I saying it correctly?
Do I miss something here?

Did you try it with the secure option not set to TRUE ?

What do you expect that will happen if I do not set it to true?
Nothing different happens?

Then most likely there is an error in your code somewhere.

this is the code…just tell me if you find anything wrong with it-at first glance:

$sesarr=session_get_cookie_params();
session_set_cookie_params($sesarr["lifetime"],$sesarr["path"],$sesarr["domain"],FALSE,FALSE);
session_start();

tell me what you think.
I do not find anything wrong in it…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.