I have a PHP script that I want to call on some form action.
This command works fine:
/usr/local/bin/php -q script.php > /dev/null 2>&1 &
But it all go wrong when I add arguments in the command:
/usr/local/bin/php -q script.php --var=value > /dev/null 2>&1 &
it returns "Ambiguous output redirect".
I have read this http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/ article too, and have tried almost everything possible as far as I can understand, and still have no idea how to fix it.
Please help me.
If your script's redirect contains a variable, and the script body defines that variable in a section enclosed by parenthesis, you will get the "ambiguous redirect" error.
&1 is used to reference the value of the file descriptor 1 (stdout). Now to the point 2>&1 means “Redirect the stderr to the same place we are redirecting the stdout” Now you can do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With