note 96249 added to function.shell-exec
| From: | martin at intelli-gens dot com | Date: | Wed, 17 Feb 2010 11:21:16 +0000 |
| Subject: | note 96249 added to function.shell-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166051@lists.php.net to get a copy of this message | ||
Also after lots of hair pulling why shell_exec didn't want to work for me I found out that in
my case some things needed to be set (which normally are set by default).
the options -jo
-j means: don't recreate the paths found in the archive
-o means: always overwrite files
And I needed to specify the destination path (even though it should unzip in the same directory when
not specified), this is done by -d [path]
The strange thing was that I didn't have to put these options when I would give the command on
the command-line, only when I would call it with shell_exec.
So the complete command in php would be for me:
shell_exec('unzip -jo /path_to_archive/archive.zip -d /destination_path')
And putting en echo in front will help you a lot.
it should tell you something like this:
Archive: /path_to_zip/archive.zip
inflating: /destination_path/file1.jpeg
inflating: /destination_path/file2.jpeg
inflating: /destination_path/file3.jpeg
----
Server IP: 69.147.83.197
Probable Submitter: 87.211.82.188
----
Manual Page -- http://www.php.net/manual/en/function.shell-exec.php
Edit -- https://master.php.net/note/edit/96249
Del: integrated -- https://master.php.net/note/delete/96249/integrated
Del: useless -- https://master.php.net/note/delete/96249/useless
Del: bad code -- https://master.php.net/note/delete/96249/bad+code
Del: spam -- https://master.php.net/note/delete/96249/spam
Del: non-english -- https://master.php.net/note/delete/96249/non-english
Del: in docs -- https://master.php.net/note/delete/96249/in+docs
Del: other reasons-- https://master.php.net/note/delete/96249
Reject -- https://master.php.net/note/reject/96249
Search -- https://master.php.net/manage/user-notes.php