Reply to Re: unzipping while preserving permissions

Your name:

Reply:


Posted by Andy Hassall on 11/21/06 20:45

On 21 Nov 2006 09:06:13 -0800, "laredotornado@zipmail.com"
<laredotornado@zipmail.com> wrote:

>I'm using PHP 4.4.4 with Apache 2 on Linux. I have a PHP function to
>unzip a file, but I would like the resulting unzipped file with all its
>sub-directories and files to have the same permissions as the parent
>file, or at least 755 perms. Right now, it is being created with
>rw-r--r-- perms. Here is my function
>
> function unzipFile($p_zip_file_path, $p_zip_file_pwd,
>$unzip_dir)
> {
> $cmd = "unzip ";
> if (!empty($p_zip_file_pwd)) {
> $cmd .= " -P $p_zip_file_pwd ";
> } //
> $cmd .= " -o -d $unzip_dir $p_zip_file_path 2>&1";
> exec($cmd, $output, $return);
> // failed if non-zero
> if ($return != 0) {
> $output = join("<BR>\n", $output) . "<BR>\n";
> return $output;
> } // if
> return "";
> }
>
>Any suggestions on how to modify it? Thanks, - Dave

What's your umask currently set to?

Do the files have permissions in the original zip file? The "unzip" man page
says:

"
Dates, times and permissions of stored directories are not restored
except under Unix. (On Windows NT
and successors, timestamps are now restored.)
"

... which implies that the contents of the zip may influence the permissions.

You could also reset the permissions after extraction, if umask isn't the key.

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация