PHP exec output
We encountered a random problem while trying to execute a program via the PHP exec command and trying to capture the output of the executed program; we always retrieved an empty String.
This is due to not using the default I/O buffer. You have to tell the shell which output buffer to use. This can be simply done by appending "2>&1" to the command.
exec($command, $output); ->
exec($command." 2>&1", $output);
et voilĂ , the output array variable should not be an empty string anymore.
Hope this helps.
Bests,
Charly
This is due to not using the default I/O buffer. You have to tell the shell which output buffer to use. This can be simply done by appending "2>&1" to the command.
exec($command, $output); ->
exec($command." 2>&1", $output);
et voilĂ , the output array variable should not be an empty string anymore.
Hope this helps.
Bests,
Charly
<< Home