2014-12-03 58 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

相關問題