• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 528
  • Last Modified:

PHP tmp files

My drives filling up with .tmp files which aren't being cleared down.

Originally, they were being stored in


I changed the following line in php.ini;


and now thew files are being saved in the new location.

Can anybody advise what these files are and what the best course of action is to ensure they get cleared down?
Is it safe to delete any of these manually?

php running under apache
it's for a moodle webserver.

1 Solution
Loganathan NatarajanLAMP DeveloperCommented:
Can you check this function , "session.gc_maxlifetime"  value set in your php.ini, ?
stantechservAuthor Commented:
session.gc_maxlifetime = 1440

Derek JensenCommented:
Any files that end in .tmp are usually safe to delete.

Also, you could just open one of them and see what they contain. If vi or emacs can't interpret them(you just see jibberish), I'd say they're definitely safe to delete.

Having said that, I'd definitely recommend making a backup of them first, *just in case*. If you're low on space, consider gzipping them, or something. :)

As for a more permanent solution to your problem, are you sure it's one of your PHP files generating these .tmp files? If so, it should be fairly straightforward to find the code that's doing it and either change or delete it. There's no reason session variables should be stored, permanently, on the server hard drive(unless you're trying to catch a hacker, or something).
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Loganathan NatarajanLAMP DeveloperCommented:
just want to know all those files are .tmp extensions ?? because it should have session files like "sess_3c98e617d6f2a2a287a7ef409799a6fb" ... it will be deleted automatically based on the time minutes set in "session.gc_maxlifetime"
stantechservAuthor Commented:
Filenames have names like;


The session files as suggested do seem to be deleted automatically.

I don't think I've mentioned it but this is all running on a Windows 2008 R2 host server

Its may be created by your Editor/IDE whichever you have been using.

The editor may create this files, for the quick processing.

Just configure your editor not to create tmp files.

This will solve your problem.

stantechservAuthor Commented:
I fogot to update this. I found the issue to be with permissions, I gave the user; .\IUSR modify permissions to the folder which resolved this


stantechservAuthor Commented:
Resolved the issue I was having. None of the other solutions were viable as the code itself was not mine and not something I could ammend
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now