Reputation: 13702
Is there a way with PHP to execute PHP functions based on time of day or day of week? I.e. store information to a database every wednesday? That is, without anyone viewing a web page or click a link to check if it wednesday each time? Any help would be great on this. I need a way to read information from a db and write it to a file every so often, i.e. once a week on my server. How can I accomplish these time dependent tasks? Thanks!
Upvotes: 0
Views: 88
Reputation: 175007
You're looking for crontab (for Linux) or Scheduled Tasks (for Windows). You can execute any PHP file directly from the server by running the PHP executable on it.
(Windows) Example:
php.exe -f P:\ath\to\php\file.php
Upvotes: 3
Reputation: 71414
Your best bet is to set your PHP script to run in Cron.
http://en.wikipedia.org/wiki/Cron
Upvotes: 2