You can create a cron job by visiting the "Cron Jobs" section of your cPanel. PHP is accessible with simply the "php" command.
For example, if we wanted to run the file located at public_html/test.php, you would use a command like such:
If you want to manually specify your PHP version, replace the "php" command with the following binary location:
PHP 5.6: /opt/cpanel/ea-php56/root/usr/bin/lsphp
PHP 7.0: /opt/cpanel/ea-php70/root/usr/bin/lsphp
PHP 7.1: /opt/cpanel/ea-php71/root/usr/bin/lsphp
PHP 7.2: /opt/cpanel/ea-php72/root/usr/bin/lsphp
By default, your cron job may send an email to your default email account every time it runs. If you have a script running frequently, this will clog up your outbound mail queue and could impact disk usage. Please see our default email account wiki page for instructions on accessing that.
To prevent this, you can add ">/dev/null 2>&1" (no quotations) to the end of your script. Like such:
Be sure to include a space between your command and the quieting command.