Using PHP's exec() function (or the likes), how can you display terminal error output?
- by Miciah Amberong
Previous Reference
I am just wondering if there's a way (using PHP) to output the compile error information from the terminal to the browser?
For example:
If you use this code to execute in the terminal...
gcc -o try try.c
...and assuming the "try.c" have some errors.
The terminal will output something like this:
try.c In function 'main':
try.c:27 'x' undeclared (first use in this function)
try.c:27 (Each undeclared identifier is reported only once
try.c:27 for each function it appears in.)
Meanwhile, using this PHP code...
<?php
exec("gcc -o try try.c");
?>
The browser does not return any output like the terminal does. Is there a possible way direct or indirect that the error details that the terminal showed can be passed to the be displayed on a browser?
Thank you very much.