title: Creating multiple zip files with PHP
body: <p>I have a problem in PHP / Laravel to create multiple zip files synchronously, I copy all commands that is generated and squeeze into the Shell, it executes normally, but when I step into the PHP run it only generates the first file = /.</p>
  
  <p>Controller code.</p>
  
  <pre><code>foreach ($passwords as $p){
          if($i == 0){
              $command = 'zip -u -j -P '.$p.' '.$dir.'/'.$count.'.zip '.storage_path().'/app/'.$directory.'/'.$file1-&gt;getClientOriginalName();
              $commands-&gt;push($command);
          }else{
              $command = 'zip --quiet -j -P '.$p.' '.$dir.'/'.$count.'.zip '.storage_path().'/app/'.$directory.'/'.($count+1).'.zip';
              $commands-&gt;push($command);
          }
          $count--;
          $i++;
      }
      foreach ($commands as $p){
          echo $p.'&lt;br/&gt;';
      }
      foreach ($commands as $c){
          $process = new Process($c);
          $process-&gt;start();
          sleep(10);
          if($process-&gt;isTerminated()){
              sleep(1);
          }
          if ($errorOutput = $process-&gt;getErrorOutput()) {
              throw new RuntimeException('Process: ' . $errorOutput);
          }
      }
  </code></pre>
  
  <p><a href="https://pastebin.com/xwuEYb1X" rel="nofollow noreferrer">Data $commands</a></p>
  
  <p>The script only generates the file 50.zip.</p>