Pregunta

Morning all,

I'm trying to give apache the write access to a particular folder for 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

Any ideas why it's not changing the directory owner?

Thanks, Harry

Update:

I am using a directory in mount for my apache base dir.

[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

The phpdocx directory is inside of my web server directories.

Update 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

It's just not changing the owners?!

Update 4:

[root@patdraft word2]# egrep -iw --color=auto 'user|group' /etc/httpd/conf/httpd                                                                          .conf
User apache
Group apache

It's not because the group is spelled 'Apache' instead of 'apache'. Any more ideas?

Update 5:

This is my error log from httpd after restarting the service;

[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, line 53

copy(
   $this->_tempFile,
   $fileName . '.' . $this->_extension
);

Update 6:

I am now mounting the ntfs share under the apache user to see if that fixes it.

¿Fue útil?

Solución 2

The problem was mounting with ntfs, and Windows(?) not allowing me to change permissions.

I edited my /etc/fstab mount point to add file_mode, and dir_mode as follows;

192.168.1.211:/APShared/IT/websites/patdraft.albright /mnt/patdraft cifs rw,username=<removed>,password=<removed>,noserverino,file_mode=0775,dir_mode=0777,exec 48 48

Otros consejos

Please check in /etc/passwd if you have such user "apache".

Please check the permission on /var/www folder and provide the same permission on the PHPDOCx folder.

Please be sure that dont put the PHPDOCx folder in home folder of some user.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top