Manual:$wgCookieExpiration

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
<translate> Cookies</translate>: $wgCookieExpiration
Number of seconds before HTTP cookies expire. You can override this for 'Keep me logged in' cookies with $wgExtendedLoginCookieExpiration
<translate> Introduced in version:</translate>pre 1.1.0
<translate> Removed in version:</translate><translate> still in use</translate>
<translate> Allowed values:</translate>(integer)
<translate> Default value:</translate>1.18–: 30 * 86400
1.19–1.28: 180 * 86400 (r94430)
1.29+: 30 * 86400 (Gerrit change 321592)

Details

The default value is 30 days (30 * 86400 seconds). This means most MediaWiki cookies will last 30 days. This includes login/session cookies when the "Keep me logged in" option is not set. When "Keep me logged in" is set, $wgExtendedLoginCookieExpiration is used instead (although by default that settings falls back to $wgCookieExpiration).

When "Keep me logged in" is not set, login expiry is also limited by $wgObjectCacheSessionExpiry (the session expires when there is no interaction for that time span).

<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.22
<translate> MediaWiki version:</translate>

Since MediaWiki 1.22 setting this configuration variable to 0 makes cookies session-only. This was previously documented as working, but broken.

This is used by WebResponse::setcookie and mw.cookie.set, though an individual cookie can have a custom expiration.

See also