All 3 PHP functions: exec(), system() and passthru() executes an external command, but the differences are:
- exec(): returns the last line of output from the command and flushes nothing.
- shell_exec(): returns the entire output from the command and flushes nothing.
- 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.
- passthru(): returns nothing and passes the resulting output without interference to the browser, especially useful when the output is in binary format.
Related Posts
- How to execute / run PHP scripts in the background?
- Linux: How to find all the files containing a particular text string?
- PHP: Read from Keyboard – Get User Input from Keyboard Console by Typing
- PHP: Back tick `
- Use stat command to display file system meta information of any file or directory under Linux

{ 1 trackback }