Yes, you can compile php as a CGI (actually this is the default). Just run it like this:
machine$ php -q myphpscript.php
If you want the script to run periodically, put it in your crontab (or AT list in NT).
The -q suppresses HTML looking messages. Here is the usage.
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>] | {<file> [args...]}
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-f<file> Parse <file>. Implies `-q'
-v Version number
-p Pretokenize a script (creates a .php3p file)
-e Execute a pretokenized (.php3p) script
-c<path> Look for php3.ini file in this directory
-i PHP information
-h This help
-Rob