CodeIgniter Forums

Full Version: sessions and ubuntu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
CI4 allows you to change the prefix. I don't know about CI3.
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.