Pantheon Community

WordPress Native PHP Sessions Plugin — New Warnings

I have recently started getting new php error messages from the WP Native Php Sessions Plugin. I migrated our company website to Pantheon from Rackspace last week, and didn’t have these messages when we migrated over. I am running WP 5.1.1 and PHP ver 7.2.

[25-Mar-2019 18:33:00 UTC] PHP Warning:  ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /srv/bindings/eb1edf5e1815436e86bb181ec87e13bf/code/wp-content/mu-plugins/wp-native-php-sessions/pantheon-sessions.php on line 131
[25-Mar-2019 18:33:00 UTC] PHP Warning:  session_set_save_handler(): Cannot change save handler when headers already sent in /srv/bindings/eb1edf5e1815436e86bb181ec87e13bf/code/wp-content/mu-plugins/wp-native-php-sessions/pantheon-sessions.php on line 141

The above error message are pointing to the following code:

LINE 131:

// Get cookie lifetime from filters so you can put your custom lifetime 
		ini_set( 'session.cookie_lifetime', (int) apply_filters( 'pantheon_session_expiration', 0 ) );

LINE 141:

		session_set_save_handler( '_pantheon_session_open', '_pantheon_session_close', '_pantheon_session_read', '_pantheon_session_write', '_pantheon_session_destroy', '_pantheon_session_garbage_collection' );

1.) Do I need to put a custom lifetime cookie value in place of zero?

RELATED:
Here is a related issue where a few other people are describing the exact same problem:
https://wordpress.org/support/topic/new-php-warnings/#post-11354119

You should not need to modify the plugin files. I am using this plugin on multiple sites and multisites without this issue - running WordPress 5.1.1 and PHP 7.2. It is my understanding that there are no custom modifications or setting changes that are necessary for this plugin to work.

The first thing I would try is clicking the Clear Caches button on your environment from the Pantheon Dashboard. That usually clears up any hiccups in the infrastructure.

Also, review the https://pantheon.io/docs/wordpress-sessions/ documentation if you have not already.

While PHP is showing the error as coming from the plugin files, the error is most likely being caused by an existing plugin or the theme that is loading before the WordPress Native PHP Sessions plugin files. Try switching the theme and/or disabling a plugin at a time until the culprit is found.

This could be as simple as a closing PHP tag “?>” at the end of a theme file.

2 Likes