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?
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.
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?
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.
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.
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?
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.
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)
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.
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?