I am hosted with 1and1.com, and I have setup my files to be parsed with php5 using .htaccess.
But that only works in apache, and not in command line, wh
I finally got this working. The problem was a few-fold.
First, the PHP being used was in /etc/bin instead of the MAMP version. I was able to change this and use the MAMP version instead.
Second, to use php via the CLI you have to make sure to use the FULL path to php and not just php itself. I.e. use /MAMP/bin/php/php5.3.x/php in your exec() call. This is now working for me.
You can check out my GIST here...https://gist.github.com/1861487