这个问题已经在这里有了答案:
9年前关闭。
Possible Duplicate:
How can I know the error in command in an exec function?
gcc -o try try.c
<?php
exec("gcc -o try try.c");
?>
最佳答案
正如@hakre在评论中指出的那样-您可以直接重定向STDERR流,但这是另一个解决方案:
exec('command here', $output, $exit_status);
if ($exit_status !== 0) echo implode('<br />', $output);
https://stackoverflow.com/questions/8239598/