I created a bunch of tempnam() files for use during my request. Do I need to specifically unlink() them when they’re not needed anymore, or will PHP / the system take care of it themselves?
Advertisement
Answer
Files created by tempnam() will not be deleted by PHP.
You’ll have to unlink() them manually.
If you need a temporary file thats automatically deleted by PHP, consider using tmpfile():
Creates a temporary file
The file is automatically removed when closed (for example, by calling
fclose(), or when there are no remaining references to the file handle returned bytmpfile()), or when the script ends.