PHP permissions mkdir and apache

Is there a way to install php under Apache to create folders with a folder belonging to the owner of the program that creates it instead of belonging to apache?

Using the word press, it creates new folders for download, but they belong to apache.apache and not to the site on which they are running. This also happens with firmware. At the moment, we have SSH on the server and chmod in the folder, but it seems that there will be a setting somewhere to redefine ownership outside of any program that does this.

+5
source share
4 answers

Safe_mode . mkdir() ( "apache", "none",..), script. (, ) ( script).

Safe_mode, .

. http://php.net/manual/en/features.safe-mode.php.

P.S. Safe_mode chmod() php.

+2

- apache - . SGID, . , - " " .

[17:57] progman@proglap /tmp/test $ ls -al /tmp/test
total 9
drwxrwsr-x  2 root users   48 Apr  1 17:55 .
drwxrwxrwt 36 root root  9264 Apr  1 17:53 ..

, SGID, - , (progman) am. , , .

[17:55] proglap ~ # touch /tmp/test/x

root. :

[17:57] progman@proglap /tmp/test $ ls -la /tmp/test
total 9
drwxrwsr-x  2 root users   72 Apr  1 17:59 .
drwxrwxrwt 36 root root  9264 Apr  1 17:53 ..
-rw-r--r--  1 root users    0 Apr  1 17:59 x

, root, users, I

[18:00] progman@proglap /tmp/test $ rm x
rm: remove write-protected regular empty file `x'? y
[18:01] progman@proglap /tmp/test $ ls -la /tmp/test
total 9
drwxrwsr-x  2 root users   48 Apr  1 18:01 .
drwxrwxrwt 36 root root  9264 Apr  1 17:53 ..

, chmod, , rw-r--r-- - . chmod, umask, , chown.

+2

, . "" , root. apache AssignUserID, /. Apache/PHP

+1

PHP chown() function

0

All Articles