When installing openlitespeed, you might run into an issue where the /tmp directory is full and has 100000 sess_ files from PHP.
This is due to the fact that there is no mechanism to remove these files on a regular basis. There is a mechanism within Ubuntu for apache and php-fpm but not openlitespeed. You can use the following commands to create a service that runs and clears out the files.
systemctl stop phpsessionclean.service
systemctl disable phpsessionclean.service
systemctl stop phpsessionclean.timer
systemctl disable phpsessionclean.timer
echo "*/30 * * * * root find -O3 '/tmp' -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin +180 -delete" > /etc/cron.d/openlitespeed-phpsessionclean
In the above code, the following occurs.
- The first 4 commands are to disable the
phpsessioncleanservice and timer, which normally runs the
This is the contents of the phpsessionclean.service file
Description=Clean php session files
- The final command creates the
/etc/cron.d/openlitespeed-phpsessioncleancronjob file, which runs every 30 minutes and deletes php sessions files that had their status changed more than 180 minutes ago.