ZipArchive php class extracts files as root. What for?

I have a php script:

$extract_dir = "./";
$extract_file = "extractME.zip";

$zip = new ZipArchive;
$res = $zip->open($extract_file);
if ($res === TRUE) {
    $zip->extractTo($extract_dir);
    $zip->close();
    echo "ok";
} else {
    echo "failed";
}

But when I execute this script, http://www.mywebsite.com/extract.php

All files on FTP are displayed using OWNER 'root', but not with ex. neo, as it should be. Thus, the user cannot edit / rename / delete these files.

Is it possible to fix it (I own the server) that the files will be extracted using the 'USERNAME' OWNERSHIP?

+3
source share
2 answers

ozzwanted, - - (apache) root, , , root. . apache "www-data" "httpd", "nobody" "god" linux.

sysadmin - , . (, )

www.php.net/chown "chown" PHP system() exec().

.

+3

, - ( : root). chown.

0

Source: https://habr.com/ru/post/1757319/


All Articles