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 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿