【发布时间】:2014-05-15 18:08:03
【问题描述】:
早上好,
我正在尝试为 apache 授予对 PHPDOCx 特定文件夹的写入权限。
[root@patdraft word2]# ll
total 4
-rwxr-xr-x 1 root root 718 May 15 2014 generate.php
drwxr-xr-x 1 root root 0 May 13 09:20 lib
drwxr-xr-x 1 root root 0 May 13 09:41 output
[root@patdraft word2]# chown -R apache:apache output/
[root@patdraft word2]# ll
total 4
-rwxr-xr-x 1 root root 718 May 15 2014 generate.php
drwxr-xr-x 1 root root 0 May 13 09:20 lib
drwxr-xr-x 1 root root 0 May 13 09:41 output
任何想法为什么它不改变目录所有者?
谢谢,哈利
更新:
我在 mount 中为我的 apache 基本目录使用了一个目录。
[root@patdraft word2]# cat /etc/passwd | grep apache
apache:x:48:48:Apache:/var/www:/sbin/nologin
[root@patdraft mnt]# ll
drwxr-xr-x 1 root root 4096 Apr 25 16:21 patdraft
phpdocx 目录位于我的 Web 服务器目录中。
更新 3:
[root@patdraft /]# chown -R apache:apache /mnt/patdraft/*
[root@patdraft /]# ll /mnt/patdraft/public_html/pages/word2/
total 4
-rwxr-xr-x 1 root root 774 May 15 09:14 generate.php
drwxr-xr-x 1 root root 0 May 13 09:20 lib
drwxr-xr-x 1 root root 0 May 15 09:33 output
只是不改变所有者?!
更新 4:
[root@patdraft word2]# egrep -iw --color=auto 'user|group' /etc/httpd/conf/httpd .conf
User apache
Group apache
这不是因为该组拼写为“Apache”而不是“apache”。还有什么想法吗?
更新 5:
这是我重启服务后来自httpd的错误日志;
[Thu May 15 10:03:15 2014] [error] [client 192.168.1.26] PHP Warning: mkdir(): Permission denied in /mnt/patdraft/public_html/pages/word2/generate.php on line 21
[Thu May 15 10:03:15 2014] [error] [client 192.168.1.26] PHP Warning: copy(/mnt/patdraft/public_html/pages/word2/output/output1400144595.docx): failed to open stream: Permission denied in /mnt/patdraft/public_html/pages/word2/lib/phpdocx/classes/CreateDocx.inc on line 5343
CreateDocx.inc,第 53 行
copy(
$this->_tempFile,
$fileName . '.' . $this->_extension
);
更新 6:
我现在正在 apache 用户下挂载 ntfs 共享,看看是否可以修复它。
【问题讨论】:
-
这是否意味着您在“/var/www”文件夹中有“PHPDOCx”文件夹?
-
它在 /mnt/patdraft/..../phpdocx/ 中。我使用 /mnt/patdraft 作为我的 /var/www。
-
尝试进入根目录 => "cd /" 然后输入一个逗号 "chown -R apache:Apache /mnt/patdraft/*"
-
使用用户/组作为 apache?
-
查看更新 3 和 4,不幸的是仍然没有运气。