CodeIgniter Forums
Why This Solution Works on CI3 and PHP 7.1+ - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Why This Solution Works on CI3 and PHP 7.1+ (/showthread.php?tid=77792)



Why This Solution Works on CI3 and PHP 7.1+ - mertdogan - 10-19-2020

I have a CI3 (3.1.11) project on IIS with PHP 7.0 . It works without any error for years. Today i need to upgrade my projects environment to PHP 7.2.7 and then very big session problem occured.

When i login to my system with ajax request, after redirect to main page everything about session has been reset.

I searched this forum and stackoverflow for this problem, writing a lot of solutions at them.

I tried to delete all of system folder and then downloaded latest from here and moved new system folder to my projects folder but it isn't solved anything.

When i downgrade to 7.0 everything works perfectly but when i change php version to 7.2 session fails to save.

A lot of hours later, i found a solution writes as this:

Code:
if you are working in CI 3.x and just upgraded your server php version to php 7.x Go to system/libraries/Session/session.php at Line no 281 and replace ini_set('session.name', $params['cookie_name']); by ini_set('session.id', $params['cookie_name']);

i don't understand but this solution solved my problem but i don't like to touch system folder files.

And now: are there any different solution to solve this problem without touch system folder files? If there isn't, why don't you merge this solution to your hard code of CI?


RE: Why This Solution Works on CI3 and PHP 7.1+ - InsiteFX - 10-20-2020

Go here and download the CodeIgniter 3.2 Developer version.

CodeIgniter 3.2 Developer