CodeIgniter Forums
sessions and ubuntu - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: sessions and ubuntu (/showthread.php?tid=73503)



sessions and ubuntu - arwystli - 05-01-2019

Today I discovered something, that Ubuntu (and Debian) do their own PHP sessions garbage collection but that sessions not prefixed by 'sess_' are ignored. So the CI default session name of 'ci_session' never gets deleted, on my ubuntu 18.04 box they can be found in /var/lib/php/sessions. The script /usr/lib/php/sessionclean which run every half hour does the cleaning and it was in there that I saw the prefix requirement.


RE: sessions and ubuntu - donpwinston - 05-01-2019

CI4 allows you to change the prefix. I don't know about CI3.


RE: sessions and ubuntu - dave friend - 05-01-2019

The other thing you will see is in php.ini with the setting session.gc_probability=0. That will result in the PHP session garbage collection never running in CodeIgniter or any other PHP session based app.

When you see session.gc_probability=0 it is done with the expectation that a CRON job will handle the chore.

If you change the value of session.gc_probabilty you can make PHP session gc to work again using all the config settings you supply CodeIgniter.

I've never noticed the prefix thing before but will look for it in the future. Thanks for the heads-up.