User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » noobalicious question (php/apache) Page [1]  
jaZon
All American
27048 Posts
user info
edit post

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

qntmfred
retired
40556 Posts
user info
edit post

cron

[Edited on July 16, 2007 at 12:37 PM. Reason : http://en.wikipedia.org/wiki/Crontab]

7/16/2007 12:36:31 PM

cdubya
All American
3046 Posts
user info
edit post

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

qntmfred
retired
40556 Posts
user info
edit post

7/16/2007 12:37:43 PM

jaZon
All American
27048 Posts
user info
edit post

yea, i saw someone mention cron on another site

but this bitch is running in windows

7/16/2007 12:40:44 PM

qntmfred
retired
40556 Posts
user info
edit post

well, there's always windows task scheduler

7/16/2007 12:43:01 PM

jaZon
All American
27048 Posts
user info
edit post

durrr, i'm SMRT

thanks

7/16/2007 12:44:29 PM

FenderFreek
All American
2805 Posts
user info
edit post

There is a really good cron for Windows called Visualcron, fyi.

7/16/2007 3:14:21 PM

30thAnnZ
Suspended
31803 Posts
user info
edit post

CRON

it's on windows

WINDOWS TASK SCHEDULER

Doh.

7/16/2007 4:31:37 PM

robster
All American
3545 Posts
user info
edit post

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

qntmfred
retired
40556 Posts
user info
edit post

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 prefer

as 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

robster
All American
3545 Posts
user info
edit post

cool ... ill check out the info file to see what its set to...

7/17/2007 12:46:29 PM

Metricula
Squishie Enthusiast
4040 Posts
user info
edit post

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

 Message Boards » Tech Talk » noobalicious question (php/apache) Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.