Start a session with the default cookie parameters
session_start();
Start a session with custom cookie parameters
lifetime = 60 * 60 * 24 * 365; // 1 year in seconds
session_set_cookie_params($lifetime, '/');
session_start();
Description
A session starts when a browser makes its first request to a page that includes the session_start() function.
By default, a session uses a session cookie to associate a browser with the data for its session. However, you can use the session_set_cookie_params() function to customize the cookie for the session.
In the session_set_cookie_params() function, the $lifetime parameter is the only required parameter. The other parameters are optional.
The session_set_cookie_params() function must be called before the session_start() function.