What is cron job ? How to set the cron job in PHP?
1) Cron is very simply a Linux module that allows you to run commands at predetermined times or intervals. In Windows, it’s called Scheduled Tasks. The name Cron is in fact derived from the same word from which we get the word chronology, which means order of time.
For a developer we write code to run that particular code at a specific time using this cronjobs or Scheduled Tasks.
2) To set the cronjob :
In the cpanel of your web hosting server in that separate link called crontab,
in that we have to set the times and dates,
run this in php file we will get server document path ,
b) In that we have the form like minutes, hours, day, month, week, if have to set values to particular time and date otherwise input as * then it treated as every minute, then in the command section we should place the
[ Minute – Hour – Day – Month – Weekday ] [PATH OF PHP] [ARGUMENTS] [PATH OF PHP SCRIPT]
In Some servers :
Example: /usr/local/bin/php -q /home/tom/public_html/cron/maintenance.php
In some server we place like
Example : php -q /home/tom/public_html/cron/maintenance.php
In the file maintenance.php we will write the code which one have to execute in the Corn job functionality.