I don't want to create too many threads so append to same topic.
- There are various ways for PHP to call external program. They include the backtick operator, system command, shell_exec command and also popen, fgets, pclose commands. I would like to know the benefits of using each command.
i. From what I read if we use backtick operator or shell_exec command, there is a limit to the output that can be returned to the variable. Somewhere in the region of 100,000 bytes ? After which we may lost some data ?
ii. System command only return the last line of the external command output so no good in this scenario.
iii.
popen(...)
while(fgets(....))
..
pclose(...)
So it seems iii is the best strategy as it attempt to read each line of output from the external command. This avoid the potential problem in i.
Any comments?