我正在我的笔记本电脑上(使用Mac OS X 10.6.7)本地运行php脚本updreading.php。
以下是updreading.php的内容:
<?php
$outFile = "examples-output.txt";
$out = fopen($outFile, 'w') or die("can't open write file");
?>
当我运行它时,我收到“无法打开写入文件”的错误消息。我认为这应该与权限有关。我已将自己(arman)设置为/Library/WebServer/Documents/的所有者,并具有读写权限,并“应用于包含的项目”。我的脚本和我正在写入的文件(examples-output.txt)位于/Library/WebServer/Documents/wabun/中。以下是/Library/WebServer/Documents/wabun/中文件的权限:
-rw-r--r--@ 1 arman admin 0 May 1 01:03 examples-output.txt
-rw-r--r--@ 1 arman staff 1657 May 1 01:04 updreading.php
我已经尝试了不同的权限设置,但是在过去的4个小时里一直无法解决这个问题。大家有什么想法来解决这个问题吗?谢谢!
var_dump(is_writable($outFile));
的输出是什么? - Charles