PHPackages                             pantheon-systems/wp-native-php-sessions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pantheon-systems/wp-native-php-sessions

ActiveWordpress-plugin

pantheon-systems/wp-native-php-sessions
=======================================

native PHP sessions stored in the database for WordPress.

1.4.5(5mo ago)1442.2k44[12 PRs](https://github.com/pantheon-systems/wp-native-php-sessions/pulls)1GPL-2.0-or-laterPHPCI passing

Since Aug 2Pushed 1mo ago65 watchersCompare

[ Source](https://github.com/pantheon-systems/wp-native-php-sessions)[ Packagist](https://packagist.org/packages/pantheon-systems/wp-native-php-sessions)[ RSS](/packages/pantheon-systems-wp-native-php-sessions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (68)Used By (1)

Native PHP Sessions
===================

[](#native-php-sessions)

**Contributors:** [getpantheon](https://profiles.wordpress.org/getpantheon), [outlandish josh](https://profiles.wordpress.org/outlandish-josh), [mpvanwinkle77](https://profiles.wordpress.org/mpvanwinkle77), [danielbachhuber](https://profiles.wordpress.org/danielbachhuber), [andrew.taylor](https://profiles.wordpress.org/andrew.taylor), [jazzs3quence](https://profiles.wordpress.org/jazzs3quence), [stovak](https://profiles.wordpress.org/stovak), [jspellman](https://profiles.wordpress.org/jspellman/), [rwagner00](https://profiles.wordpress.org/rwagner00/), [anaispantheor](https://profiles.wordpress.org/anaispantheor)
**Tags:** comments, sessions
**Requires at least:** 5.3
**Tested up to:** 6.9
**Stable tag:** 1.4.6-dev
**Requires PHP:** 7.4
**License:** GPLv2 or later
**License URI:**

Use native PHP sessions and stay horizontally scalable. Better living through superior technology.

Description
-----------

[](#description)

[![Actively Maintained](https://camo.githubusercontent.com/2ae5ff81f271fb028d720adee6b3595770166f3707a4705a4a2a3b71c332b249/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50616e7468656f6e2d4163746976656c795f4d61696e7461696e65642d79656c6c6f773f6c6f676f3d70616e7468656f6e26636f6c6f723d464644433238)](https://pantheon.io/docs/oss-support-levels#actively-maintained-support)[![CircleCI](https://camo.githubusercontent.com/ebb89ac08db9ddba645be3b5b5e5491bc73c6b8b3a7f6b60848bed2008e83b1c/68747470733a2f2f636972636c6563692e636f6d2f67682f70616e7468656f6e2d73797374656d732f77702d6e61746976652d7068702d73657373696f6e732f747265652f6d61696e2e7376673f7374796c653d737667)](https://circleci.com/gh/pantheon-systems/wp-native-php-sessions/tree/main)

WordPress core does not use PHP sessions, but sometimes they are required by your use-case, a plugin or theme.

This plugin implements PHP's native session handlers, backed by the WordPress database. This allows plugins, themes, and custom code to safely use PHP `$_SESSION`s in a distributed environment where PHP's default tempfile storage just won't work.

Note that primary development is on GitHub if you would like to contribute:

Installation
------------

[](#installation)

1. Upload to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress

That's it!

Configuration
-------------

[](#configuration)

By default the session lifetime is set to 0, which is until the browser is closed.

To override this use the `pantheon_session_expiration` filter before the Native PHP Sessions plugin is loaded. For example a small Must-use plugin (a.k.a. mu-plugin) could contain:

```
