Re: Event Handling
| From: | Ashley Sheridan | Date: | Mon, 15 Mar 2010 12:55:35 +0000 |
| Subject: | Re: Event Handling | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-302849@lists.php.net to get a copy of this message | ||
On Mon, 2010-03-15 at 18:28 +0530, Midhun Girish wrote:
> rene "a page with an ajax script that kicks off the check-for-recent-events
> script on the server".. but that method is highly non reliable.... i dont
> think anyone will take that risk especially for an important web app....
> cron or any equivalent which runs on the server must be used instead of
> that..
>
>
> Midhun Girish
> Development Lead
> MobAlive Technologies
>
>
>
> On Mon, Mar 15, 2010 at 6:08 PM, Jochem Maas <jochem@iamjochem.com> wrote:
>
> > Op 3/15/10 12:00 PM, David Hutto schreef:
> > > On Mon, Mar 15, 2010 at 7:31 AM, Jochem Maas <jochem@iamjochem.com>
> > wrote:
> > >
> > >> Op 3/15/10 8:24 AM, Midhun Girish schreef:
> > >>> Hi ,
> > >>> Just as David Hutto has said,What you need is the cronjob... Make a
> > >> script
> > >>> say "check.php" which checks the db to see if any new entries are
> > made...
> > >>> and if yes send the mail ...
> > >>>
> > >>> now using the cronjob feature in linux os(which will be provided as a
> > >>> service in your linux hosting cpanel), set a cronjob which calls the "
> > >>> http://www.yoursite.com/check.php" URL
> > >>> every minute.... now a trigger
> > >> will
> > >>> be there every minute to the script and the emails will be send
> > >> irrespective
> > >>> of whether anyone is browsing the site or not.... hope it is clear...
> > >>>
> > >>
> > >> use cron - yes
> > >> have cron call a web URL - no, instead just call the script via the php
> > CLI
> > >> sapi,
> > >> e.g. a cmdline as follows in cron:
> > >>
> > >> /usr/env php /path/to/your/check.php &> /dev/null
> > >>
> > >
> > >
> > > I do believe removing the /dev/null will send error messages during the
> > > building of the script, correct?
> > >
> >
> > the '&> /dev/null' redirects all output - I kind of make the assumption
> > that the
> > script would be logging stuff to a file or something when in production.
> >
> > so, yes, remove the redirection when your developing/testing the script.
> >
> >
> >
I agree. Even setting a cron on a local computer to call home to a
server script would be preferable to Ajax calls.
Thanks,
Ash
http://www.ashleysheridan.co.uk