1. Home
  2. Computing & Technology
  3. PHP / MySQL

Session_set_cookie_params () PHP Function

By Angela Bradley, About.com

Definition: Session_set_cookie_params () is used to set information about the session cookie, including the duration. It is phrased as session_set_cookie_params (seconds, optional_path, optional_domain, optional_security). This is not as effective as editing the php.ini file, and only lasts for the duration of the script, so you would need to call it on every page before session_start().
Also Known As: Set Session Cookie Duration
Examples:
//sets cookie to 1200 seconds or 20 mins
session_set_cookie_params(1200);
session_start();

Explore PHP / MySQL

More from About.com

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Session Cookies - Session Cookie Length - Session Set Cookie Params

©2008 About.com, a part of The New York Times Company.

All rights reserved.