RE: [PHP] cron job style php...
| From: | Hans Zaunere | Date: | Sun, 16 Jan 2005 23:27:11 +0000 |
| Subject: | RE: [PHP] cron job style php... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206494@lists.php.net to get a copy of this message | ||
> I have written a simple script that when a date in an array matches todays
> date, it sends an email (notifies me when bills are due). Any ideas on how
> to make this run once a day? Can you do a cron job on a PHP prog?
It can, and run basically like any other shell script.
The first line needs to be the dash-bang that point to your PHP binary.
#!/usr/local/php/bin/php
<?php
Note that the opening tag is required. No closing tag is required.
Note that you can/should compile PHP to contain the CLI binary (new releases
do). You can check what kind of PHP binary you have using -v:
Shell> /usr/local/php/bin/php -v
To keep track of scripts that I run under Apache, versus those that run on
the command line, I use the .psh extension on those that run on the command
line.
---
Hans Zaunere
President, Founder
New York PHP
http://www.nyphp.org
Gmail: The 1gb spam catcher