What are the implications of session cookies being stored only in RAM and not on the client's machine?

Session cookies being stored only in RAM means that they are not persistent and will be lost when the browser is closed. To solve this issue, we can set the session cookie to be stored on the client's machine by using the setcookie() function in PHP.

session_start();

// Set session cookie to be stored on the client's machine
setcookie(session_name(), session_id(), time() + 3600, '/');

// Your code here