This is a discussion on How do you make a script run automatically? within the PHP Language forums, part of the PHP Programming Forums category; Please forgive me if this has been asked before. Is it possible to have a php script run automatically? I ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Please forgive me if this has been asked before.
Is it possible to have a php script run automatically? I am talking about the sort of script that handles regular activities such as issuing invoices, reminders etc? How are these run? Does somebody have to go in and push a button, do you have to tell the server to run these scripts at a particular time, or is there another way? Thanks Hamilton |
|
|||
|
Michael Fesser wrote:
> .oO(Spidah) > > >>Please forgive me if this has been asked before. >> >>Is it possible to have a php script run automatically? > > > With a cronjob (Unix/Linux) or another kind of scheduling mechanismn. > ....and only if PHP's installed as a CGI (on Unix/Linux). Ed |
|
|||
|
Ed Jones <home-newsgroups@edjones.org> wrote:
>>>Is it possible to have a php script run automatically? >> >> >> With a cronjob (Unix/Linux) or another kind of scheduling mechanismn. >> > > ...and only if PHP's installed as a CGI (on Unix/Linux). BS: * 0 * * * lynx http://localhost/shedule/this/script.php Where lynx can be replaced by lots of other commands (like nc, wget, w3m, curl...) -- Daniel Tryba |
|
|||
|
"Spidah" <h.laughland@eggstra.co.nz> wrote in message news:<OJRid.4061$op3.153462@news.xtra.co.nz>...
> Please forgive me if this has been asked before. > > Is it possible to have a php script run automatically? > > I am talking about the sort of script that handles regular activities such > as issuing invoices, reminders etc? How are these run? Does somebody have to > go in and push a button, do you have to tell the > server to run these scripts at a particular time, or is there another way? Use PHP 5 which makes it easy to turn a script into a daemon that can run as a normal service on any computer. Then just write the script as you would any other computer program, launch it once and it will run forever. If you want a reminder, just have it keep a list of dates (in an array, or XML, or a database, or anything else) and it can send a message to standard output when you need the reminder, or, better, it can send you an email. |
|
|||
|
Daniel Tryba wrote:
> Ed Jones <home-newsgroups@edjones.org> wrote: >>...and only if PHP's installed as a CGI (on Unix/Linux). > > BS: > * 0 * * * lynx http://localhost/shedule/this/script.php > > Where lynx can be replaced by lots of other commands (like nc, wget, > w3m, curl...) > Yeah, cool - hadn't thought of doing it like that :-) Ed |
|
|||
|
"lawrence" <lkrubner@geocities.com> wrote in message news:da7e68e8.0411060123.344707f@posting.google.co m... > "Spidah" <h.laughland@eggstra.co.nz> wrote in message > news:<OJRid.4061$op3.153462@news.xtra.co.nz>... >> Please forgive me if this has been asked before. >> >> Is it possible to have a php script run automatically? >> >> I am talking about the sort of script that handles regular activities >> such >> as issuing invoices, reminders etc? How are these run? Does somebody have >> to >> go in and push a button, do you have to tell the >> server to run these scripts at a particular time, or is there another >> way? > > Use PHP 5 which makes it easy to turn a script into a daemon that can > run as a normal service on any computer. Then just write the script as > you would any other computer program, launch it once and it will run > forever. If you want a reminder, just have it keep a list of dates (in > an array, or XML, or a database, or anything else) and it can send a > message to standard output when you need the reminder, or, better, it > can send you an email. Firstly thanks to everyone who has responded. How would I go about turning a PHP5 script into a daemon? This sounds like it could be the solution I need? Regards Hamilton |
|
|||
|
"Spidah" <h.laughland@eggstra.co.nz> wrote in message
> Firstly thanks to everyone who has responded. > > How would I go about turning a PHP5 script into a daemon? This sounds like > it could be the solution I need? Sams (the publisher) I think has a new book out on PHP 5 which has a good chapter on running PHP 5 as a daemon. I read most of it the last time I was in a Barnes and Noble bookstore (I'm in America right now). There should also be documentation on the www.php.net site, but I haven't found it. Haven't looked much either. |