开发者

How to run php script at 12am everyday [duplicate]

开发者 https://www.devze.com 2023-02-17 04:58 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: PHP: running scheduled jobs (cron jobs)
This question already has answers here: Closed 10 years ago.

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 u开发者_如何转开发ser'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?


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.


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


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


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.


See cron.


Create a bash script and run it as a cronjob

0

精彩评论

暂无评论...
验证码 换一张
取 消