I need to run a php script every night at around the same time. I can't rely on someone to run the script and need it to be automated. How would I go about doing that?
7/16/2007 12:34:55 PM
cron[Edited on July 16, 2007 at 12:37 PM. Reason : http://en.wikipedia.org/wiki/Crontab]
7/16/2007 12:36:31 PM
the easiest solution depends on what OS your host machine is running, but assuming *nix you could use a cron job.http://en.wikipedia.org/wiki/Crontab[Edited on July 16, 2007 at 12:37 PM. Reason : ^beat me by 30 secs, you ass :-p]
7/16/2007 12:37:05 PM
7/16/2007 12:37:43 PM
yea, i saw someone mention cron on another sitebut this bitch is running in windows
7/16/2007 12:40:44 PM
well, there's always windows task scheduler
7/16/2007 12:43:01 PM
durrr, i'm SMRTthanks
7/16/2007 12:44:29 PM
There is a really good cron for Windows called Visualcron, fyi.
7/16/2007 3:14:21 PM
CRONit's on windowsWINDOWS TASK SCHEDULERDoh.
7/16/2007 4:31:37 PM
Does running a php script via cron still make the script act as if you called it yourself through a browser, ie... will it time out after so long, or is that a server side configuration that determines the amount of time the script can run?
7/17/2007 12:32:34 PM
as far as i know, running php via cron is just the same as running it via browser. the main difference is output is rendered to the browser. whereas with cron, stdout is the mail system (ie you'll get an email with the script output every time a cron job runs). you can also pipe the output to a file or whatever else if you preferas far as timeouts go, a php script can call set_time_limit() to specify max execution time. the default is 30 seconds, or whatever is specificed in php.ini[Edited on July 17, 2007 at 12:47 PM. Reason : pipes]
7/17/2007 12:44:23 PM
cool ... ill check out the info file to see what its set to...
7/17/2007 12:46:29 PM
You can run php.exe (in the php directory), with the php file as a parameter, or piped through STDIN (i can't remember which). Then just setup something in windows task scheduler to run it.Alternatively, you can have an apache web serversetup, and have windows task scheduler connect to it with a program like WGET (http://en.wikipedia.org/wiki/Wget).
7/17/2007 6:33:39 PM