Compile PHP as a CGI binary, install it into /usr/local/bin or similar, and you can use the CGI binary to run scripts locally. Just write them as you would a Perl script - i.e.
#!/usr/local/bin/php -q
...code...
I think it's -q that suppresses HTTP header output, but I'm not sure...