Skip to content

Commit 3f84112

Browse files
committed
docs: Deleting expired session files
1 parent ad8ba45 commit 3f84112

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

user_guide_src/source/libraries/sessions.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,22 @@ Instead, you should do something like this, depending on your environment:
552552
chmod 0700 /<path to your application directory>/writable/sessions/
553553
chown www-data /<path to your application directory>/writable/sessions/
554554
555+
Deleting Expired Session Files
556+
------------------------------
557+
558+
The built-in handlers do not have the function of deleting expired sessions. You need to set it up yourself.
559+
You need to set up a **cron** task, for example:
560+
561+
.. code-block:: console
562+
563+
0 2 * * * find /path/to/your/project/writable/session -type f -name 'ci_session*' -mmin +1440 -delete
564+
565+
It will delete stale sessions that haven’t been used for more than 24 hours.
566+
567+
- The session path should be set to: ``Config\Session::$savePath``.
568+
- The session name should be set to: ``Config\Session::$cookieName``
569+
- The user running the cron job should have permission to access and delete those session files.
570+
555571
Bonus Tip
556572
---------
557573

0 commit comments

Comments
 (0)