doutan8506 2010-01-20 16:56
浏览 60
已采纳

为什么我不能从PHP守护进程的子进程中删除文件?

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?

  • 写回答

1条回答 默认 最新

  • douxi9245 2010-01-20 17:02
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献