PHP shell脚本和MAMP上的PHP之间的区别?

This is weird to me. I wonder why. I wrote a PHP script to validate syntax of another PHP script named test.php

 <?php
    print("Hello World");
    ?>

The validating script index.php is:

#!/usr/bin/env php
<?php
exec("php -l test.php", $error, $retcode);
echo($retcode . "<br />");
var_dump($error);
?>

When I run on command line php index.php, it generates this output:

0<br />array(1) {
  [0]=>
  string(37) "No syntax errors detected in test.php"
}

This looks good to me. However, when I run on localhost it generates this output:

#!/usr/bin/env php 5
array(0) { }

Why $retcode is set to 5? Also, I'm on PHP5.3

Okay, I already figured this out.

Check http://linux.die.net/man/1/rsync for exit code info.

The problem is that I have to use the PHP interpreter on MAMP, which is:

exec("/Applications/MAMP/bin/php/php5.3.6/bin/php -l $file",$error,$retcode);

The one I used before was PHP interpreter on OS X.