开发者

Why can't I delete a file from a PHP daemon's child process?

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 spawn开发者_如何转开发ed 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?


/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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜