Question

I am building a simple PHP daemon script, using a php Daemon class provided at:
http://www.phpclasses.org/browse/file/8958.html

I'm stuck with this class for better or worse, and I don't have much time to get this done; so in order to issue custom commands to the daemon I'm just using a command file located in the /tmp directory. However I need to delete this file after the daemon has processed any commands contained therein.

However, when I try to "unlink" the file in PHP, the unlink operation simply fails, and the file remains. I know for a fact that it is not a permissions issue. In fact I am quite certain this has something to do with the fact that each "iteration" of the daemon is spawned as a child process, and that sub-process must somehow not have permission to delete files.

My question: Why can't PHP delete this file, and what can I do about it?

Was it helpful?

Solution

/tmp usually has the sticky bit set so i believe only the user which deposited the file there can delete it. Do your child processes run under the same user as the parent process (apache, www, etc..)? Which process instance created the file?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top