cron - PHP set cronjob for every 1 minutes -


first time setting cron job. have 1 simple php file. when file called insert 1 record in database.

<?php mysql_connect("localhost","root",""); mysql_select_db("cron_db") or die(mysql_error()); $tm = time(); $sql = "insert test(time) values(".$tm.")"; if(mysql_query($sql)) {     echo "done"; } ?> 

i have uploaded file server in "public_html/dev/insert.php"

for have written below command

1 * * * * /usr/bin/php /home/domain/public_html/dev/insert.php

it isn't working. can me fix this?

the line

1 * * * * /usr/bin/php /home/domain/public_html/dev/insert.php 

will execute cron job each first minute of hour. want is:

*/1 * * * * www-data /usr/bin/php /home/domain/public_html/dev/insert.php 

note, i've inserted column user should execute file (in case, webserver user. root or username.)


Comments