I have two files:
first.php:
#!/usr/bin/php
<?php
exit("Unable"); //1
#exit(1); //2
#exit(); //or exit(0) //3
?>
second.php:
#!/usr/bin/php
<?php
exec("./first.php",$out,$err);
var_dump($out);
echo "\n".$err;
?>
Now, When I run second.php with line #1 in first.php I have “Unable” in $out and 0 in $err. but with two other exits I have that digit in $err.
How can I have non-zero in $err when I execute exit with string message?
I have tested 2>&1 but it’s useless.
Is the same as:
So just echo the statement 🙂