I'm trying to create PHP script that will update my website on some specific date. Can someone help me with this?
Asked
Active
Viewed 148 times
-3
-
Do you know anything about cron? If you do not know, then I advise you to learn about it from google. And if you fail to configure cron on your server / hosting, do not forget to google "cron online". Well, and as an option, if you have some traffic and the script runs at least once a day, just compare the date. – nektobit Oct 20 '18 at 07:09
1 Answers
0
PHP itself cannot execute itself at a specific time, that is instead handled by your server. You can configure your server to execute your scripts at any interval you like.
If you are using a linux based machine (most likely if you are using PHP), it is called a cronjob. You can access it by typing crontab -e
on your command line and adding the line:
* * * * * /path/to/your/script.php
Those stars represent the interval, like so minute hour day-of-month month day-of-week
For example, to run it on the 20th of October at 9am, it would be 0 9 20 10 * /path/to/script

Benjamin Dowson
- 584
- 5
- 14