I am new to using cron jobs, but I have studied the basics. I am able to call php using cron tab. When run manually, the code is executed. But when it is run from the cron job php can't read the log file.
$log = 'text.log';  
$saved = 10; 
$deleted_line = count(file($log))-$saved; 
$chk_size = filesize($log)/1024;
if($chk_size >= 2048) {
 $total_lines = file($log);  
    $final_lines = array_slice($total_lines, $deleted_line);
    $file = fopen('amrut-all-projects.log', 'w');
    $result = fwrite($file, implode('', $final_lines));
    fclose($file); 
    }  else { 
       echo 'Your File size less then 5kb.'; 
} 
 
     
     
     
    