1

I know this question, but it covers only files created by an upload process or tmpfile() that are automatically deleted at the end of the request. Instead I want to know how long files stay that are manually created in the system temp folder f.e. through file_put_contents() and sys_get_temp_dir().

If the pruning is done through the operation system, please answer how the different major webserver operation systems handle it.

Community
  • 1
  • 1
mgutt
  • 5,867
  • 2
  • 50
  • 77

2 Answers2

1

The system temporal directory will be purged based on the OS type and configuration, some OS delete on boot, others mont a tmpfs as temporal directory, etc.

1

For Linux, refer to the file system hierarchy standard. That's what you can expect.

The thing is, just don't care when the files will get deleted (if you are not the sysadmin). Just expect that the tempfile isn't there any more after you've closed it and write your code having that in mind.

hek2mgl
  • 152,036
  • 28
  • 249
  • 266