Our website isn't displaying because the C:\Windows\Temp directory can't be written to, because C:\ is now out of space. The reason: tons of sess_230498230493240 [random hash] files. Like, thousands.

php.ini is set to use C:\Windows\Temp for temp session files, but why aren't these being auto-deleted? What's the correct way to handle this?


I would set up a schedualed task, or use an temporary AppData folder in order to delete temporary php generated files


I think creating a scheduled task for is a messy solution. The reason is the PHP worker process does not have sufficient permission to delete the expired session files in that directory.

Open your php.ini file and change the session.save_path value to another directory other than C:\Windows\Temp (e.g. C:\PHP\Temp) with the right write and delete permissions for subfolder and files in the mentioned directory.

Then save your php.ini file and restart IIS. It works robustly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.