CRON Jobs with PHP -


i link cron jobs cron.php, includes connection etc:

<?php     include "includes/top.php";     include "test.php";      $test = new test;     $test->update(); ?> 

then text.php is:

<?php     class test{         private $db;          public function __construct(){             $this->db = new connection();             $this->db = $this->db->dbconnect();         }          public function update(){             $st = $this->db->prepare("insert cron (content) values (?)");             $st->execute(array("ok"));         }      } ?> 

when visit link www.*/cron.php works , uploads database. want. when activate cron jobs id doesn't work @ all. hosting provider tells me nothing's wrong. i've ask, way of doing cron job or correct?

sometimes executing php cli not allowed on shared hosting. try execute script via webserver.

to use curl in cron:

/bin/curl http://www.yourdomain.com/cron.php 

or use wget:

/bin/wget -o - http://www.yourdomain.com/cron.php 

and let cron send error messages you.


Comments