dongzhukuai8177 2012-10-02 13:33
浏览 24

是什么导致PHP锁定文件

On my server, occasionally, scripts and cache files created by scripts become locked by the PHP process. Once locked they cannot be accessed either via network share, locally on the server or by PHP itself. Refreshing the page results in access denied errors:

Warning:  rmdir(C:\inetpub\wwwroot\mdblog\public\..\cache\posts\2012) 
[function.rmdir]: Directory not empty in
C:\inetpub\wwwroot\mdblog\public\system\Filesystem.php on line 52

Line 52 is rmdir($dir);.

The problem is more prevalent after a 'high' amount of disk operations (refreshing a page quickly in succession, deleting many files at once etc). It is a Windows Server 2008 R2 server with IIS7 and PHP 5.3.13 (using FastCGI), running on a VM server, no virus-scanner, with PHP installed using the Web Platform Installer. dxdiag

Doing an iisreset fixes the problem temporarily. I am writing a static site generation function however which causes this problem to come up every few minutes.

  • 写回答

2条回答 默认 最新

  • douzhonglong3789 2012-10-02 13:40
    关注

    As the error is saying, the folder is not empty, so cannot be erased. Might be because not all temporary files got deleted. Try implemeneting and using a recursive function...

    function rrmdir($dir) {
        foreach(glob($dir . '/*') as $file) {
            if(is_dir($file))
                rrmdir($file);
            else
                unlink($file);
        }
        rmdir($dir);
    }
    

    This function will delete everything inside a folder and then delete it.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c