I have a shell_exec in a php script, and I want to receive the error message from compilation ( if it exists ) as a return from shell_exec or to get it from a file...but I can't to this.
Here is a try
$compiler=shell_exec("g++ '$path''$file_name' -o '$path''$evaluate_id' >& '$path''$error'");
shell_exec
function can return NULL
both when an error occurs or the program produces no output.
It is not possible to detect execution failures using this function.
exec()
should be used when access to the program exit code is required.
g++ prints error messages to stderr. shell_exec
captures what g++ prints to stdout.
Redirect stderr to stdout or use a different function to invoke g++.