user3771934
user3771934

Reputation: 3

php os command shell_exec delay & timing code included

I am trying to run a Linux command in php like "wget" but so if the server is downloading a big file does

<? $s = shell_exec("wget file"); echo $s ; ?>

does echo $s; shows the downloading bar i'm sure it doesn't
the question is how to run another cmd after this file finishes
what i am trying to say that when the downloading is finished run an other command like

<? 
$s = shell_exec("wget filename.zip"); 
echo $s ;
$c = shell_exec("unzip filename.zip"); 
echo $c; 
?>

Upvotes: 0

Views: 227

Answers (1)

Barmar
Barmar

Reputation: 781096

The shell_exec() function doesn't return until the command is done. If it produces interactive output, like a progress bar, you won't see it until the end.

And if you're running the PHP script through a webserver, the browser doesn't normally show anything until the script is done. This page shows a trick using PHP's output buffering functions to display intermediate results, but I'm not sure how reliable it is; it seems to depends on implementation details of Internet Explorer.

Upvotes: 1

Related Questions