Symptoms
PHP session files in folder /var/lib/php/session/
are not removed automatically.
Cause
Session file folder was changed from default /var/lib/php/session/
:
# grep -ir session.save_path /opt/plesk/php/*/etc/php.ini | grep -v ";"
/opt/plesk/php/7.4/etc/php.ini:session.save_path = "/var/lib/php74/session"
Resolution
Apply one of the following solutions:
Change the current PHP session folder to default one in Plesk UI
-
Open Tools & Settings > PHP Settings and select the PHP handler with changed session.save_path value
-
Click on php.ini tab
-
Find
session.save_path
parameter and set it to/var/lib/php/session
Create scheduled tasks for different PHP session directories
-
Access the server via SSH
-
Copy original task:
# cp /etc/cron.hourly/plesk-php-cleanuper /etc/cron.hourly/php74-cleaner
-
Edit the file php74-cleaner and change the last line to the following:
[ -x /usr/lib64/plesk-9.0/maxlifetime ] && [ -d /var/lib/php/session ] && /usr/lib64/plesk-9.0/php_session_cleaner /var/lib/php74/session $(/usr/lib64/plesk-9.0/maxlifetime)