Hi, here is the quick way to do it.
- Log in to cPanel and open Cron Jobs.
- Under Common Settings, pick "Once Per Day". Then set Minute to 0 and Hour to 2. Leave Day, Month and Weekday as they are.
- In the Command box, paste this:
/usr/local/bin/php /home/yourusername/public_html/script.php
Change yourusername to your cPanel username, and fix the path if your script is in another folder. You can see the full path in File Manager.
- Click Add New Cron Job. Done.
If it doesn't run, the PHP path may be different on your server. Try /usr/bin/php instead, or ask support which one to use.
Also, cron uses the server time, not your local time, so 2 AM means 2 AM on the server.
If you don't want an email every time it runs, add this at the end of the command: