Bobcares

CodeIgniter generating too many sessions files | Resolved

by | Oct 25, 2021

Is CodeIgniter generating too many sessions files?

At Bobcares, we resolve similar queries as a part of our Server Management Services.

Our Support Team is here with a quick fix to empty out the /tmp folder and delete those additional sessions files.

What is CodeIgniter?

Before we delve into resolving this issue, let’s take a look at CodeIgniter. It is a PHP framework used to develop applications. CodeIgniter offers box libraries to connect to the database to perform several operations like uploading files, sending emails, managing sessions and so on. Furthermore, it offers several advantages like:

  • Security
  • Customizability
  • Hassle-fee migration
  • User-friendly interface
  • Quick development
  • MVC based system
  • Better SEO

About CodeIgniter generating too many sessions file>

Recently, one of our customers approached us with an issue where the disk space on /tmp had filled up. Our Support Engineers investigated the issue. After that, we soon discovered that the CodeIgniter application had created too many cl_sessions files in the server tmp folder. In other words, the sessions files were piling up in the /tmp folder.

How to resolve CodeIgniter generating too many sessions files

To resolve this, the sessions files were removed automatically by adding the following entries to the php.ini file:

session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440

Moreover, in order to ensure that the issue did not arise again, our Support Techs also verified that regenerate_destroy and expiration were enabled in the CodeIgniter configuration file. For instance:

onfig['sess_driver'] = 'files';
$config['sess_cookie_name'] = ‘mysession';
$config['sess_expiration'] = (60 * 60);
$config['sess_save_path'] = FCPATH . "sessions";
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;

Our Support Techs would also like to point out that you will not be able to delete the files if gc_probability value is 0. In other words, set it to 1 to enable automatic file deletion.

With these changes, you will be able to put a stop to CodeIgniter generating too many sessions files.

[Looking for further assistance? Give us a call today. ]

Conclusion

At the end of the day, the skilled Support Team at Bobcares demonstrated how to easily automatically delete additional sessions generated by CodeIgniter.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF