2014-12-03 59 views
0

我试图写入文件,但PHP告诉我,它被禁止。fopen()无法打开流:权限被拒绝

我试图改变权限,分配文件到组'apache'(根据<?php echo whoami(); ?>),但它没有奏效。

这里是我的文件的结果:

phpversion: 5.4.16 
uname: Linux 

exists // echo file_exists($file) ? ' exists' : ' does not exist', "\n"; 
is readable // echo is_readable($file) ? ' is readable' : ' is NOT readable', "\n"; 
is NOT writable // echo is_writable($file) ? ' is writable' : ' is NOT writable', "\n"; 

Warning: fopen(system/cache/cache.currency.1417623063): failed to open stream: Permission denied in /var/www/html/test/test.php on line 23 
last error: array(4) { 
    ["type"]=> 
    int(2) 
    ["message"]=> 
    string(87) "fopen(system/cache/cache.currency.1417623063): failed to open stream: Permission denied" 
    ["file"]=> 
    string(30) "/var/www/html/test/test.php" 
    ["line"]=> 
    int(23) 
} 

你能帮助我吗?

回答

0

这是SELinux。它阻止了所有文件更改,所以我能够读取,但不能写入。

1

您设置了哪种fopen模式?足够读取文件fopen("/var/www/html/test/test.php", "r");

+0

这是另一个问题,谢谢。 (查看答案) – jerry 2014-12-06 17:09:59

相关问题