I would like to store anonymous users $_SESSION in a cookie so that their cart and other custom information is still available even after closing the browser.

I found this interesting post which tells me I should add this to my local.settings.php:

ini_set('session.cookie_lifetime', 60 * 60 * 24 * 7);
ini_set('session.gc_maxlifetime', 60 * 60 * 24 * 7);
ini_set('session.save_path', '/home/yoursite/sessions');


So that session cookie would be available for a week.
But it also stands that we should use session_regenerate_id() elseway the cookie lifetime is not updated.

I could not find session_regenerate_idin Drupal 7 source code, but I believe Drupal might already handle this from what I read in the code comments.

My questions are:


is this a good approach to have persistent cookie sessions?
do I need to add to my local.settings.php session_regenerate_id() too?


Thank you very much for your advises


Question: How do electrical devices suck electricity?
Answer: It is not the most straightforward viewpoint to say that a device "needs 1500 watts". This is more a consequence than a condition. What happens is that you create an electric circuit by plugging in a device into the outlet. That circuit follows Ohm's law: $$V = I R$$ So for a given voltage and resistance a certain current $I$ will flow. The power is simply $$P = V I = V^{2}/R = I^2 R$$The device does not know anything, it just has a property, it's resistance $R$.