【发布时间】:2014-03-30 12:19:24
【问题描述】:
我的服务器在 /var/www/html 我在 /var/www/html/fileio_test/io_test.php 中有一个 php 脚本
<?php
$logging = <<< LOG
This is a test
LOG;
$testfile = fopen('/home/djameson/test.txt', 'a');
fwrite ($testfile, $logging);
fclose($testfile);
?>
当我尝试运行这个脚本时,我得到了
Warning: fopen(/home/djameson/test.txt): failed to open stream: Permission denied in /var/www/html/fileio_test/io_test.php on line 7
Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/html/fileio_test/io_test.php on line 8
Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/html/fileio_test/io_test.php on line 9
如何让 apache 写入我的主目录?服务器在 fedora 20 上运行。
【问题讨论】:
-
经常会遇到这个错误,要快速解决它,请按照以下步骤操作:stackoverflow.com/a/36577021/2873507