A
A
Azat Kiberov2019-01-19 19:51:16
Access rights
Azat Kiberov, 2019-01-19 19:51:16

How to change permissions from 777 to 755 when unpacking an archive?

Faced a problem.
When unpacking an archive using php unzip, the permissions are set to 777 for folders and 666 for files.
How to put instead of them 755 for folders and 644 for files when unpacking?
And here is the unzip php code.

<?php
$zip = new ZipArchive;
if ($zip->open('zip.zip') === TRUE) {

    // путь к каталогу, в который будут помещены файлы
    $zip->extractTo('.test/');
    $zip->close();

    // удача
} else {
    // неудача
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2019-01-19
@saboteur_kiev

Use tar.gz instead of zip - it can save Posix permissions.
Otherwise, no way, zip does not know how. Unless then run an additional command that will do chmod
Well, the last option is umask

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question