Note that there are some explanatory texts on larger screens.

plurals
  1. POcronjob not executed for a particular file
    text
    copied!<p>I have a cron set to run a php file but for some reason it doesn't work when the time comes. I can manually call same file in terminal and it works fine. No error message as well.</p> <p>Note: There are many more jobs set for different folder&amp;files and they all work fine. Permissions are same as well.</p> <p>Thanks</p> <p><strong>CRON</strong></p> <pre><code>30 2 * * 1,2,3,4,5 php /var/www/html/cronjob/update-db.php </code></pre> <p><strong>PERMISSIONS</strong></p> <pre><code>drwxr-xr-x 2 root root 4096 Nov 20 10:17 cronjob -rwxr-xr-x 1 root root 5808 Nov 21 17:21 update-db.php </code></pre> <ul> <li>conn.php is being used by many other cronjobs and works fine.</li> <li>this code works fine when I call run it in terminal.</li> <li>every other cronjob works fine apart from this.</li> </ul> <p><strong>CODE</strong></p> <pre><code>require_once "/var/www/html/dbfolder/conn.php"; function write_log($message) { $filename = 'update-sis-assessment-column-log.txt'; if (file_exists($filename)) { $handle = fopen($filename, 'a'); } else { $handle = fopen($filename, 'w'); //chmod($filename, 0644); } fwrite($handle, $message . "\r\n\r\n"); fclose($handle); exit; } if (connectDB() === true) { $query = "SELECT......."; $rcset = mysql_query($query); $terms = null; if (@mysql_num_rows($rcset) &gt; 0) { while ($records = mysql_fetch_array($rcset)) { if (ctype_digit($records['Term'])) { $terms .= "'" . substr($records['Term'], 0, 4) . "-01', "; } } $terms = substr($terms, 0, -2); } write_log('DONE : ' . $terms); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload