Issue
- Old php session files are not cleared automatically.
- Session file names looks as follow
# ls /var/home/user/.cagefs/opt/alt/php80/var/lib/php/session/
ci_session23perhue8sl5n8e8uo0h61pitq4kvvou
ci_session27gpg1tnf3djc259gs0rhbjss1truns1
Environment
- CloudLinux
- CageFS
- ea-php / alt-php
- cPanel / Plesk
Solution
Configuretmpwatch
to clean custom directories inside CageFS
To clean-up directories/dir1
and/dir2
inside CageFS create/etc/cagefs/cagefs.ini
configuration file and specifytmpwatch_dirs
directive as follows:tmpwatch_dirs=/dir1,/dir2
Note: Actual location of those directories in real file system is $USER_HOME/.cagefs/dir1
and $USER_HOME/.cagefs/dir2
.
Cause
Session files do not match the mask sess_[a-z0-9]*
[root@server ~]# ll -ah /var/home/user/.cagefs/opt/alt/php80/var/lib/php/session/
total 84K
drwx------ 2 user user 12K Mar 11 03:58 .
drwx------ 3 user user 4.0K Nov 18 2022 ..
-rw------- 1 user user 34 Feb 20 04:57 ci_session23perhue8sl5n8e8uo0h61pitq4kvvou
-rw------- 1 user user 34 Feb 20 00:07 ci_session27gpg1tnf3djc259gs0rhbjss1truns1
-rw------- 1 user user 34 Feb 20 07:28 ci_session2jj0s59683mv9gcf0tst6iek0f3eo9nu
-rw------- 1 user user 34 Feb 20 08:30 ci_session356rt1g5j5t9n896vaj2skjtqb07rrsf
-rw------- 1 user user 34 Feb 20 00:10 ci_session6k07215g7gk22hq0s937tstb35hi6fei
-rw------- 1 user user 34 Feb 19 20:06 ci_session6lscjun6ckbe4lldq30l7pmd3tfn244e
Script clean_user_php_sessions
deletes only files which names match mask sess_[a-z0-9]*
. If php was configured to use non-standart session file prefix in some custom save_handler, these session files wouldn't be managed by clean_user_php_sessions
We only remove files with session.save_path that contain/sess_.*/
by default.
Useful inks
Cleanup PHP sessions in cPanel
Comments
0 comments
Please sign in to leave a comment.