I get the output of a shell command in PHP as
$str = shell_exec("command");
and run the PHP script in terminal. When the shell command returns an error, it will be printed on the terminal. How can I tell shell_exec to return the command output only without any error output?