Clean Magento session folder
On a VPS hosting Magento 1.9 disk was getting full. On checking, found var/session folder taking too much disk space.
Disk usage was 34 GB.
This folder is used to store PHP session files. You can delete them.
I created a cronjob to delete the session files that are older.
mkdir /usr/serverok/ vi /usr/serverok/clean-session
Add following content
#!/bin/bash /bin/find /path/to/var/session -type f -mtime +10 -name "sess_*" -delete
Make it executable
chmod 755 /usr/serverok/clean-session
Set a cronjob to run everyday
@daily /usr/serverok/clean-session > /dev/null 2>&1
Method 2 – Strong session in database
Edit file
vi app/etc/local.xml
Find
Replace with