问题
Well I am new to the term CRON
. What I know about this, it is a Unix
concept to schedule particular operation to be executed after a defined time interval.
I need to run a php
file, to update database once every hour. But my confusion is with scheduling the execution. I am using XAMPP
for local development test on Windows 7.
What I found:
- How to run a php file as a cron job in cPanel in Bigrock Shared Hosting service?
- Setting Up A Cronjob In Windows Xampp
- How to create cron job using PHP?
In all the above links, they are saying to configure a cron
job on linux shell level. So is it, that the cron is on OS level and not on application level program.
If yes, then how can I create a cron in php on a shared hosting.? If I do not have access to the command line, then I cannot create a Cron job for php.?
If no, then how?
In all the above example I found one similar fashion of code:
0 * * * * cd C:/xampp/htdocs/plugins/moviefeed/ && php cron.php
What is this *
for?
回答1:
Obviously you set crons at OS level not at Application level. Although, Like on Unix/Linux, You can set CRON at windows platform too by using Task Schedular ( All Programs->Accessories->System Tools -> Task Schedular )
. I think you should go for VPN or Dedicated Servers for crons to set as it needs access to system resources privately.
Apart from it, Syntax for Crontab command
(unix/linux) goes like this:
1 2 3 4 5 /root/backup.sh
1: Minute (0-59)
2: Hours (0-23)
3: Day (0-31)
4: Month (0-12 [12 == December])
5: Day of the week(0-7 [7 or 0 == sunday])
/path/to/command - Script or command name to schedule
来源:https://stackoverflow.com/questions/25236484/php-cron-job-on-xampp-windows