0

Possible Duplicate:
PHP: running scheduled jobs (cron jobs)
How can I make my PHP script run at a certain time everyday?

I basically need a way to run a script that's going to check if someone has attended an event and at 12am, add the event to a user's events table. I can get that part no problem. I just need it to run every day at the end of the day or first thing in the morning (12am). It's going to be a php script. How can I make this run everyday at 12am?

Community
  • 1
  • 1
Drew Bartlett
  • 1,863
  • 5
  • 23
  • 37

6 Answers6

4

If you have access to the host you're running on and it's a UNIX-like machine, using cron would be your best bet.

yan
  • 20,644
  • 3
  • 38
  • 48
2

You can use a scheduler to run the script for you at the specified time. For example, if you're on Linux, you could use cron. http://en.wikipedia.org/wiki/Cron

Virtualage
  • 31
  • 4
1

Make a cron job/scheduled task and start the php cli like "php.exe myscript.php" at 12am.

Tobias Schittkowski
  • 2,221
  • 2
  • 16
  • 25
0

Your best bet is a cron job. If you're on shared hosting, this is usually available by going to cPanel and selecting "Cron tasks" or something similar.

iamandrus
  • 1,400
  • 2
  • 16
  • 25
0

See cron.

Felix
  • 88,392
  • 43
  • 149
  • 167
0

Create a bash script and run it as a cronjob

Jai
  • 3,549
  • 3
  • 23
  • 31