PHP tmp files

Posted on 2012-08-23
Last Modified: 2012-11-13
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.

Question by:stantechserv
    LVL 36

    Expert Comment

    by:Loganathan Natarajan
    Can you check this function , "session.gc_maxlifetime"  value set in your php.ini, ?

    Author Comment

    session.gc_maxlifetime = 1440

    LVL 9

    Expert Comment

    by:Derek Jensen
    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).
    LVL 36

    Expert Comment

    by:Loganathan Natarajan
    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"

    Author Comment

    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
    LVL 1

    Expert Comment


    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.


    Accepted Solution

    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



    Author Closing Comment

    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

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now