php:: how long to tmp files stay?

后端 未结 3 833
终归单人心
终归单人心 2020-11-30 03:39

I am working on an upload script.

If a user uploads a file and it already exists I want to warn the user (this is all through ajax) and give them the option to repla

3条回答
  •  天命终不由人
    2020-11-30 04:21

    There are three variables that need to be set in PHP to make sure that Garbage Collection of the /tmp directory happens correctly and they are:

    session.gc_maxlifetime = 21600
    session.gc_probability = 1
    session.gc_divisor = 100
    

    Set session.gc_maxlifetime to be the number of seconds you want each tmp file to last before it's deleted. If you login to the admin in OpenCart, this is the number of seconds until you will automatically be logged out. For example to set half an hour, you would do 60 seconds times 30 minutes which would be a value of 1800 seconds.

    The other two variables are related to when the Garbage Collector will run, and it's important that they are set to the values above if you're having problems with this.

    More info here: https://www.antropy.co.uk/blog/opencart-php-session-tmp-files-filling-up/

提交回复
热议问题