Fix - CodeIgniter session not set with PHP 7.x
Today I had to do some updates to an old web app I made with CodeIgniter. The original app was made around 5 years back and there has been no changes to it until this one. All this time it was living in one of my old web servers with PHP 5.6 and had no issues at all. However, when I tried to setup this in my local machine (inside Vagrant, with PHP 7.x), I found some issues with the sessions. I noticed the sessions are not getting persisted between the redirects.
After some research, I found out that the issue was actually with the PHP version. Luckily, I didn't have to change it to an old PHP version. There was an easy fix (somewhat surprising), and I got it working in no time.
If you ever face this issue, all you got to do is: in your CI folder, open the CI/system/libraries/Session/Session.php file and look for a line which says:
and change it to
and that's it. Your app should start working fine :)
ReplyDeleteI’m impressed by the details that you¡¦ve on this web site. webcare360
It reveals how nicely you understand this subject.
I'm impressed by the information about web application on this website. It demonstrates how well you understand this subject.
ReplyDeleteThanks for sharing this amazing and informative post. keep sharing with us.
ReplyDelete