0

I have this PHP script which updates my database when the webpage is visited via https://......

    <?php
//
database connection file.....


        if($wa->cron()){

        echo "Updated";
    }
     ?>

How can I set a cronjob to visit this every 24hours?

I entered these commands but didn't work /home/xxxxx/public_html/cron.php and /home/xxx/public_html/cron.php

and I entered the web address directly still didn't work.

Please help.

vsol
  • 97
  • 2
  • 10

1 Answers1

1

If you're trying to setup a cronjob in linux to call your php file every 24 hours here's how you do it. In your terminal type contab -e, select your preferred editor and at the end of the file type:

0 0 * * * php /path/to/your/script.php

This will call that script every day at midnight (your server's time). Also be careful, as crontab runs under your currently logged user and running these commands as root might expose your server to some dangers.

George V.
  • 140
  • 5