Exec ('unzip gallery.zip', $ return); Php

Can someone please let me know why I could not get the result for php function

exec('unzip gallery.zip',$return);
print_r($return);
+3
source share
3 answers

Did you check the return value when unpacking? Error messages are not indicated in the standard output stream, so the array will be empty if something fails.

<?php
    $result = array();
    exec("unzip archiv.zip", $result, $returnval);
    print_r($result);
    print_r($returnval);
?>

Does unpacking work as expected? It may require overwriting, etc., if the files already exist and stop the workflow. This result will not be recorded as a result.

+5
source

Did you have the variable initialized $returnbefore use?

unzip, Unix Linux? ( , Windows)

0

stderr exec, backticks shell_exec.

passthru() ( stdout).

Ps: , :

File not found: Does it existgallery.zip in cwd . Use absolute paths and escapeshellarg () . Rest assured.

or

File permissions : Is php allowed to write extracted files to cwd or the specified path to the path?

0
source

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


All Articles