CodeIgniter Forums

Full Version: Issue with sessions on v3.1.10 and PHP 7.2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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,

https://stackoverflow.com/questions/4575...g-on-php-7

Hope this helps.
Hey,

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?