Codeigniter 3 session not working

On a web application, session not working. I verified PHP session is working with script

https://gist.github.com/serverok/8c504205ae0357e0c6488eab880a77bf

When refreshing the script, the number start increasing, that confirms PHP session works fine on the server.

As for Codeigniter, we need to check the session settings in file application/config/config.php

That looks good. Session will be saved in folder

FCPATH will be replaced with web application root folder where index.php is present. I verified ci_session folder exists and changed its permisison to 777, but that did not fixed the session problem.

To verify session is working, i added 2 function to controller

I can call these functions to verify is session is setting properly with url like yourdomain/controller-name/function-name

The problem was due to PHP 7. To fix it, edit file

Find

Replace with

You can find more about Codeigniter session at https://codeigniter.com/userguide3/libraries/sessions.html

Leave a Reply

Your email address will not be published. Required fields are marked *