[PHP] cron job style php...

2005-01-16 Thread Russell P Jones
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?

Russ Jones

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cron job style php...

2005-01-16 Thread Randy Johnson
Russel,
Yes you can run a cron job on php
You may have to add a line like this at the top, it has been awhile since I 
have done it]

#! /usr/local/php/sapi/cli/php
this line would be different for your system
-Randy
- Original Message - 
From: Russell P Jones [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, January 16, 2005 6:00 PM
Subject: [PHP] cron job style php...


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?
Russ Jones
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] cron job style php...

2005-01-16 Thread Hans Zaunere

 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 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cron job style php...

2005-01-16 Thread Bret Hughes
On Sun, 2005-01-16 at 17:00, Russell P Jones wrote:
 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?
 
 Russ Jones


Never tried it but on linux (RHL or Fedora) I would add a file to
/etc/cron.daily with something like this in it

/usr/bin/php /usr/local/bin/myjob.php

where myjob.php  is the php script.  if it runs from the command link
now it should work.  This will run as root of course and if you wnated
it to be run as someone else you could probably add the line:

0 2 * * * username /usr/bin/php /usr/local/bin/myjob.php

to /etc/crontab  or the users crontab without the username field.

hth

Bret

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cron job style php...

2005-01-16 Thread Ligaya Turmelle
Check out here - http://www.htmlcenter.com/tutorials/tutorials.cfm/155/php/
and here -
http://www.phpfreaks.com/tutorials/28/0.php
and if you want to read about my learning with cron try here -
http://www.khankennels.com/blog/index.php?p=103
Hope it all helps.
Respectfully,
Ligaya Turmelle
Russell P Jones wrote:
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?
Russ Jones

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php