Cron jobs
How to schedule a PHP script or URL to run automatically at set intervals in cPanel.
Cron runs a command at a set time, for example sending notifications, cleaning temporary files or WordPress tasks.
Creating a cron job#
- In cPanel open Advanced → Cron Jobs.
- Optionally enter an email address in Cron Email to receive command output.
- Under Add New Cron Job choose the frequency in Common Settings (e.g. Once Per Hour) or manually fill in minutes, hours, days, months and weekdays.
- Enter the command in the Command field.
- Click Add New Cron Job.
Example commands#
Running a PHP script (replace scyhost1 with your cPanel user, and check the PHP path in cPanel or with us):
bash
/usr/local/bin/php /home/scyhost1/public_html/cron.php >/dev/null 2>&1Calling a URL:
bash
curl -s https://yourdomain.com/cron.php >/dev/null 2>&1WordPress cron#
WordPress runs its tasks when the site is visited, which can be unreliable. For larger sites turn that off in wp-config.php:
php
define('DISABLE_WP_CRON', true);and add a cron job that calls wp-cron.php every 15 minutes:
bash
curl -s https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1Vam je bil ta članek v pomoč?
Hvala za vaše mnenje! Potrebujete pomoč? Odprite zahtevek.
Sorodni članki
WordPress white screenWhy WordPress shows a blank page or a critical error and how to fix it step by step.Changing the PHP versionHow to choose a PHP 8.x version for a domain in MultiPHP Manager and what to check afterwards.PHP errors and logsWhere to find error_log, how to enable error logging and how to read errors when troubleshooting.PHP extensionsHow to check and enable extensions such as imagick, intl, mbstring or zip in Select PHP Version.
