-3
我在linux上有一個名爲mygroup的組。並有一個名爲apache的用戶。 apache是mygroup的成員。使用PHP在linux服務器上創建目錄時出錯代碼
我創建了一個樣本PHP文件和上載服務器
<?php
$structure = '/my_repo/hello';
if (!mkdir($structure, 0, true)) {
die('Failed to create folders...');
}
?>
myrepo dir是在根級別和是組是MYGROUP和所有者是根。權限是764.
當我訪問的http://mydomain.com/sample.php
我的文件,它給了我下面的錯誤
[warn] mod_fcgid: stderr: PHP Warning: dir(/my_repo/hello)
[<a href='function.dir'>function.dir</a>]: failed to open dir:
Permission denied in /var/www/clients/client1/web2/web/sample.php
好像你沒有權限在'/'中創建目錄。文件夾'/ my_repo /'是否存在?嘗試簡單地mkdir('/ my_repo /')。它給了什麼? – 2012-04-06 12:01:07
你檢查了你的目錄寫入權限嗎? – Elena 2012-04-06 12:01:49
你用PHP警告得到你的答案。您沒有權限創建目錄。在Windows中,它很簡單,但在Linux中檢查腳本和目錄等的CHOWN。 – StudioArena 2012-04-06 12:34:18