PHP: Differences between exec(), shell_exec(), system() and passthru()

All 3 PHP functions: exec(), system() and passthru() executes an external command, but the differences are:

  1. exec(): returns the last line of output from the command and flushes nothing.
  2. shell_exec(): returns the entire output from the command and flushes nothing.
  3. system(): returns the last line of output from the command and tries to flush the output buffer after each line of the output as it goes.
  4. passthru(): returns nothing and passes the resulting output without interference to the browser, especially useful when the output is in binary format.

Related Posts:

Google

Leave a reply

Google

Good Boys

Do NOT subscribe, I’m a shameless self-promoter!

Thesis Theme for WordPress:  Options Galore and a Helpful Support Community

We are …

We write with …

Written with Windows Live Writer

We appreciate your …