代码在 fopen() 处阻塞:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$fp = fopen("/path/to/file/some_file.txt","a") or die("can't open file");
fwrite($fp,"some text");
fclose($fp);
?>
结果网页显示:
“警告:fopen(/path/to/file/some_file.txt)[function.fopen]:无法打开流:第 5 行的 /var/www/html/test.php 中的权限被拒绝无法打开文件”
我尝试使用文件权限,但无济于事。我更改了用户/组chown apache:apache some_file.txt
并更改了权限chmod 755 some_file.txt
。以下是相关结果ls -l /path/to/file/
:
-rwxr-xr-x 1 apache apache 0 Apr 12 04:16 some_file.txt