Well, for PHP to work on the shell without apache, you need to compile it as an cgi. (meaning without --with-apxs)
But you also could do something like
lynx localhost/script.php
that should work as well... I am not 100% if it would work like I wrote it, but I do not that it does, cos I did it like a year ago, once....long time ago...
best regards
Klaus