我有非常简单的以下php文件:
<p>1 Some HTML, I am not losing my mind</p>
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
在命令行执行时,一切都很好,数据写入文件。 当我尝试在firefox浏览器上执行它时,我看到了&#34;一些HTML,我并没有失去理智&#34;注释出现但服务器上没有任何内容。
这是权限问题吗?我正在使用ubuntu服务器。文件位于具有以下权限的public_html目录中:
bomble@ChemAlive:~$ ls -la public_html
total 24
drwxrwxr-x 4 bomble bomble 4096 Feb 18 11:22 .
drwxr-xr-x 8 bomble bomble 4096 Feb 18 09:42 ..
drwxr-xr-x 12 bomble bomble 4096 Feb 16 13:43 Website
-rw-rw-r-- 1 bomble bomble 18 Feb 18 11:19 newfile.txt
-rw-rw-r-- 1 bomble bomble 232 Feb 18 11:19 process.php
drwxrwxr-x 2 bomble bomble 4096 Feb 18 11:22 test
感谢您的帮助!