Beware that when using PHP on the command line, die("Error") simply prints "Error" to STDOUT and terminates the program with a normal exit code of 0.If you are looking to follow UNIX conventions for CLI programs, you may consider the following:<?phpfwrite(STDERR, "An error occurred.\n");exit(1); ?>In this way, when you pipe STDOUT to a file, you may see error messages in the console and BASH scripts can test for a response code of 0 for success:rc@adl-dev-01:~$ php die.php > testAn error occurred.rc@adl-dev-01:~$ echo $?1Ideally, PHP would write all Warnings, Fatal Errors, etc on STDERR, but that's another story.