Set cron job in linux Server using PHP Script
In this Article,I will show how to set cron job in linux using PHP Script.we can execute a Linux Cron Jobs Every Second Using Crontab.we can also schedule tasks on Linux using crontab.I have written PHP Script to set cronjob on linux server.

Example: Set cron job in linux Server using PHP Script

<?php

 $vpath= str_replace("\\","/",$local_directory=dirname(__FILE__));
  /* 
Minute :(0-59)
Hour:  (0-23)
Day of Month:  (1-31)   
Month  :   (1-12)
Day of Week:(0-6)                
*/
//  Suppose we have to set a cronjob to run every 10 minutes

$schedule="10 * * * *"; //`Minute` `Hour` `Day of month` `Month` `Day of Weeek`
$cron_path="cron/test_cron.php";
$cron_path=$vpath."/$cron_path";
$cron_string=$schedule." php -q ".$cron_path;

 // e.g. :php -q /home/test/public_html/cron/test.php
$data=$cron_string;
$cronFile ="/var/spool/cron/root";
$fl = fopen($cronFile, 'w') or die("can't open file");
$data = $data;
fwrite($fl, $data);
fclose($fl);
?>