【发布时间】:2010-11-18 18:05:00
【问题描述】:
我在进行测试时遇到了一个问题(并在 prod 上尝试过,不行),我有一个 php 脚本创建一个文件并将一些数据放入该文件中。
我已经使用 winSCP 将“所有者、组、其他”的权限设置为 R、W、X(我对命令行还不太了解)。
我可以看到脚本能够创建文件(我已删除,并且每次都正确地重新创建文件),但完全相同的脚本无法写入文件并且我获得了权限错误。 “打开流失败:权限被拒绝”
这是我正在使用的脚本,它在 Windows 上工作,但现在在 linux 上,不行。
有什么想法吗?
$type='得到'; $count_my_page = ("list".$counterDate.".txt"); if(!file_exists($count_my_page)){ $fp=fopen($count_my_page, "w"); $putArray=array($type=>'1'); $putJson=json_encode($putArray); fputs($fp, $putJson); fclose($fp); } 别的 { $hits = file($count_my_page); 如果(空($命中)){ $putArray=array($type=>'1'); $putJson=json_encode($putArray); } 别的 { $putArray=json_decode($hits[0], true); if(!array_key_exists($type, $putArray)){ $putArray[$type] = '1'; } 别的 { $hit=$putArray[$type]; $putArray[$type]++; } } $putJson=json_encode($putArray); $fp=fopen($count_my_page, "w"); fputs($fp, $putJson); fclose($fp); }【问题讨论】: