Results 1 to 10 of 10

Thread: Newbie Q:Is it possible to have PHP script run on server every minute automatically

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Newbie Q:Is it possible to have PHP script run on server every minute automatically

    I'm trying to make a script that will monitor a certain site (eg: weather forecast) and if it contains a certain value then the script must email me.
    I want this script to continually run, but without me having to open it in my web browser.
    So is it possible to make the script execute on the server every 1 minute or so?
    If not in PHP, then what language is this possible in?
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatically

    You can run a PHP script stanalone from by simple supplying it with the script path:
    Code:
    # linux
    ~# php script.php
    
    # windows
    C:\>\path\to\php.exe script.php
    in linux you can use a cron job to have it run every minute. In windows you can have it run as a scheduled task.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatically

    Thanx for the help.
    How would I setup the cron job if I'm using GoDaddy shared Linux hosting?
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatically

    i don't know how their interface is set up, so you could try either asking their technical support about setting up a cron job, or just start looking through your control panel for anything about scheduled tasks or cron jobs.
    Like Archer? Check out some Sterling Archer quotes.

  5. #5
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatically

    Quote Originally Posted by shirazamod
    Thanx for the help.
    How would I setup the cron job if I'm using GoDaddy shared Linux hosting?
    I'm pretty sure GoDaddy hosting doesn't support this. I briefly looked into them for hosting and it didn't seem that great.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatically

    Damn! Do you know of any free hosts that support cron jobs?
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  7. #7
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatically

    I highly doubt that there are any free hosts that would. you can try searching, but I wouldn't be surprised if you didn't find anything.
    Like Archer? Check out some Sterling Archer quotes.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatically

    I've actually found a few by searching Google, but none of them seem to work fine.
    I've found a PHP script called Virtual Crontab which supposedly allows you to simulate Cron jobs, but I haven't been able to check it out yet (I'm not on my own computer)
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  9. #9
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatical

    Quote Originally Posted by shirazamod
    I've actually found a few by searching Google, but none of them seem to work fine.
    I've found a PHP script called Virtual Crontab which supposedly allows you to simulate Cron jobs, but I haven't been able to check it out yet (I'm not on my own computer)

    Ive looked into this and these scripts do work, how ever if the webserver is restarted you need to manualy call the scripts again.

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Newbie Q:Is it possible to have PHP script run on server every minute automatically

    Thanks for the heads up.
    Do you know of any way around this? Also, do you happen to know how often GoDaddy would restart their servers (every day? week? month?)

    I think a possible workaround would be to setup virtual cron jobs on 2 different servers, and somehow make each one check that the other is working, and if not then it must call the script on the other server. Think it'll work?
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width