Welcome Guest, Not a member yet? Register   Sign In
Issue with sessions on v3.1.10 and PHP 7.2

I've migrated a bunch of projects to a new server and i'm running into issues with sessions not functioning properly. The same projects on the old server work just fine.

Projects are all using CI v3.1.10 and are using database sessions

The old server the projects were running on was using
  • Apache
  • PHP 5.5.9
  • Ubuntu Server 16.04
The new server is running
  • Apache
  • PHP 7.2
  • Ubuntu Server 18.04
If it makes any difference the new server is a container running on proxmox.5.3

I can see every time i reload the page on one of these projects that new sessions are being created in the database for each page load. When i output the cookies using console.log(document.cookie) i cannot see the session cookie being set which is what i assume is causing a new session to be created on every page load.

I have also tried both http and https to see if theres any difference and the results are the same using either. There's also no information in error logs relating to the sessions either.

The problem is not with the CodeIgniter. PHP 7.1 onwards had few changes in session declaration and handling which create an issue at the time of the session.

There are some workarounds to mitigate this issue,


Hope this helps.


So i tried the solution you linked me too and did see it previously, it worked and sessions are functioning again however im getting the following warning multiple times on every page load:

Quote:A PHP Error was encountered
Severity: Warning

Message: session_set_save_handler(): Cannot change save handler when session is active

Filename: Session/Session.php

Line Number: 110

Editing the Session.php class and the main index.php file doesn't really seem like a proper solution for the issue, there are other comments which mention upgrading to the latest CI version to fix the issue but i'm already using the latest. Is there a fix for this planned as part of an official CI release so we don't have to maintain this ourselves on multiple projects?

Theme © iAndrew 2016 - Forum software by © MyBB