Sessions

The plugin session (class yf_session, _class('session')) starts the PHP session of every web request (console runs have none). It sets the session cookie and the session.* ini values from its settings, can store the sessions in the database instead of PHP's files, rotates the session id while a visitor is active and keeps a few sys_* keys in $_SESSION (request count, IP, current URL).

Where the settings come from

Each setting is a public property of yf_session. A site sets it in its config or on the Settings page (both are $PROJECT_CONF['session']); the older main()->SESSION_<NAME> properties still work. When both are set, the value of $PROJECT_CONF['session'] (or a site subclass of yf_session) wins; a main()->SESSION_* value applies only to a setting still at its framework default. So the session conf wins only with a value that differs from the class default: 'COOKIE_SECURE' => false in $PROJECT_CONF['session'] does not undo main()->SESSION_COOKIE_SECURE = true; remove the main value instead.

$PROJECT_CONF['session'] = [
    'LIFE_TIME' => 7200,          // seconds
    'COOKIE_SAMESITE' => 'Lax',
];
// the older form, still read
main()->SESSION_LIFE_TIME = 7200;

Settings

SettingDefaultEffect
OFFfalseNo session at all (also conf('SESSION_OFF')).
LIFE_TIME18000Seconds: the lifetime of the cookie and session.gc_maxlifetime. The id is rotated on a request once 10 % of it has passed since the last rotation. 0 leaves these ini values as php.ini sets them.
SAVE_DIR''A folder under STORAGE_PATH for PHP's session files (created when missing); empty: the session.save_path of php.ini.
USE_UNIQUE_NAMEtrueCookie name sid_<number> per site and side (user, admin); false: session.name of php.ini.
DOMAIN, COOKIE_PATH'', '/'Domain and path of the cookie.
COOKIE_SECUREfalseThe cookie only over HTTPS.
COOKIE_HTTPONLYtrueScripts cannot read the cookie.
COOKIE_SAMESITE'None''Lax', 'Strict' or 'None' (sent with HTTPS only).
USE_STRICT_MODEfalsesession.use_strict_mode: PHP refuses ids it did not create.
REFERER_CHECK''session.referer_check.
DESTROY_EXPIRED, EXPIRE_FIXfalse, falseWhat happens to a session idle longer than LIFE_TIME (expiry, in the admin docs).
GC_PROBABILITY0session.gc_probability while LIFE_TIME is set (cleanup, in the admin docs).
REGENERATE_DELETE_OLDfalseThe id rotation deletes the data of the old id (expiry, in the admin docs).
CUSTOM_HANDLER''Save handler: 'db' (the sessions table) or empty for PHP's own handler. 'files' is deprecated and goes in 4.0: use SAVE_DIR. An unknown name falls back to PHP's handler.

Save handlers

Without CUSTOM_HANDLER PHP stores the sessions itself (files under SAVE_DIR or session.save_path, or any handler php.ini names, such as Redis). 'db' stores them in the table sessions; its settings are $PROJECT_CONF['session_driver_db'], with GC_FIX (default false; cleanup, in the admin docs). A site driver is a class session_driver_<name> in classes/session/ with the methods open, close, read, write, destroy, gc.