Encountered with permission problem even with 2&>1 (although chmod 777), but workaround by reading the output via saving into a file
See the example, cs_crypto is something to decrypt
<?php
$str = $_GET['pswd'];
$output = shell_exec("echo $str");
echo "<pre><font color='white'>$output</font></pre>";
//$output = shell_exec("echo ./cs_crypto de aesbase $str");
//$output = shell_exec("./cs_crypto de aesbase $str 2>&1");
exec("./cs_crypto de aesbase $str > out");
$output = shell_exec("tail -1 out");
//exec('./cs_crypto de aesbase $str', $output, $return_var);
//echo "<pre><font color='white'>$return_var</font></pre>";
echo "<pre><font color='white'>$output</font></pre>";
?>
So the final result in web