Ok, make your script, but use the cgi version of php (compile php with no options, just ./configure, make, and then make install) ... then add the following line to the top of your script:
#!/usr/local/bin/php -q
This will tell it to use the php parser to parse the script. Last, but not least, we need the to address the timing issue. On almost all flavors of *nix, you will find that cron is installed by default. Take a look at /etc/crontab and add a line in this file that looks similar to:
/12 * /path/to/your/phpscript
the */12 tells it to run every five minutes (given that there are 12 5 minute intervals in an hour) and this should take care of your problems. Hope that helps!
Chris