How to Set Up a cPanel Cron Job (Full Guide)
Setting up a cPanel cron job doesn't require SSH access or Linux experience — the hosting panel gives you a form. Here's the whole process:
- Log in to cPanel.
- Scroll to the Advanced section and click Cron Jobs.
- Under Add New Cron Job, pick a schedule from Common Settings (e.g., "Once Per Day") or fill in the five time fields yourself.
- Enter the Command to run.
- Click Add New Cron Job.
Done — your cPanel scheduled task now runs automatically. The part that trips people up is step 4: what exactly goes in the command box? That depends on whether you're running a script file or hitting a URL, so let's get both right.
Choosing a Schedule in cPanel
The Common Settings dropdown fills in the five time fields for you with presets like Once Per Hour (0 * * * *) or Once Per Day (0 0 * * *). For anything custom, the fields work exactly like standard cron:
| Field | Range | Example |
|---|---|---|
| Minute | 0–59 | 30 |
| Hour | 0–23 | 2 |
| Day | 1–31 | * |
| Month | 1–12 | * |
| Weekday | 0–6 | * |
So a cpanel cron every hour at half past is 30 * * * *, and every night at 2:30 a.m. is 30 2 * * *.
One hosting-specific caution: many shared hosts restrict how often cron can run (every 15 minutes is a common floor) and may throttle accounts that schedule heavy jobs every minute. Check your host's policy before setting aggressive schedules.
Command Option 1: Run a PHP Script Directly
The most efficient way to run a PHP file — a WordPress task, a custom cleanup script, a queue worker — is to call the PHP interpreter with the script's full path:
/usr/local/bin/php /home/username/public_html/cron.php
Replace username with your actual cPanel account name (shown on the right side of the cPanel home screen) and adjust the path to your script.
Two details matter here:
- The PHP path varies by host.
/usr/local/bin/phpis the most common, but some hosts use/usr/bin/phpor version-specific binaries like/opt/cpanel/ea-php82/root/usr/bin/php. Your host's documentation lists the right one. - The script runs as your account, so it can read and write your files — no web server involved, no HTTP timeout limits.
For WordPress specifically, a popular optimization is disabling the built-in visitor-triggered scheduler and running it from a real cron job instead:
/usr/local/bin/php /home/username/public_html/wp-cron.php
(then set define('DISABLE_WP_CRON', true); in wp-config.php).
Command Option 2: Request a URL
Sometimes the task only works through the web — the script depends on the application's routing, or it lives on another server. In that case, make the cron job fetch a URL using wget or curl:
wget -q -O /dev/null https://example.com/cron.php
or
curl -s https://example.com/cron.php > /dev/null
Breaking down the wget version: -q silences progress chatter, and -O /dev/null throws away the downloaded page instead of saving files named cron.php.1, cron.php.2… into your home directory — a classic mess when this flag is forgotten.
Direct script vs. URL — which to pick? Run the script directly when you can: it's faster, avoids web-server timeouts, and doesn't expose a public endpoint. Use the URL method when the code requires the full web application context. If you do expose a cron URL, protect it with a secret token (cron.php?key=long-random-string) so strangers can't trigger it.
Managing Email Notifications
By default, cPanel emails the output of every cron run to your account's address — useful for testing, noisy in production. You have three levels of control:
- Change the address: set it in the Cron Email box at the top of the Cron Jobs page.
- Silence one job: append
>/dev/null 2>&1to its command, which discards both output and errors:
``bash /usr/local/bin/php /home/username/public_html/cron.php >/dev/null 2>&1 ``
- Keep a log instead: redirect to a file so you get history without inbox spam:
``bash /usr/local/bin/php /home/username/public_html/cron.php >> /home/username/logs/cron.log 2>&1 ``
The log approach is the best default — silent, but auditable when something breaks.
Editing and Deleting Existing Jobs
Every job you've added appears in the Current Cron Jobs table at the bottom of the same page, with Edit and Delete links beside each row. Editing reopens the schedule fields and command for that entry; deleting takes effect immediately with no confirmation beyond the click, so copy the command somewhere first if you might want it back. If your host allows SSH, crontab -l shows the same list — cPanel's form is just a friendly front end over your account's standard crontab.
Common cPanel Cron Job Mistakes
- Using
phpwithout the full path. The cron environment may not find it. Always use the interpreter's absolute path. - Wrong file path. The web URL
example.com/cron.phpcorresponds to the disk path/home/username/public_html/cron.php— the two are not interchangeable in the command box. - Forgetting
-O /dev/nullwith wget. Your home directory slowly fills with downloaded copies of the page. - Scheduling every minute on shared hosting. Hosts throttle or suspend accounts for this; check the allowed minimum interval.
- Leaving a cron URL unprotected. Anyone who discovers it can fire your task repeatedly. Add a token check.
- Testing only by waiting. Load the script in your browser or run it once manually first, so you know the code works before blaming the schedule.
Conclusion
A cPanel cron job is a five-minute setup: open Cron Jobs under Advanced, choose a schedule, and point the command at either the PHP interpreter plus your script's full path, or a wget -q -O /dev/null URL fetch. Redirect output to a log file, keep the schedule within your host's limits, and your scheduled task will hum along untouched for years.
Want to understand the schedule fields more deeply? Our cron syntax guide explains every character — and if a job ever stops firing, the troubleshooting guide will find it.
Frequently Asked Questions
Where are cron jobs in cPanel?
Log in to cPanel and scroll to the Advanced section, then click Cron Jobs. You can also type "cron" in the search bar at the top of the cPanel home screen to jump straight there.
How do I run a URL as a cron job in cPanel?
Use wget or curl as the command: wget -q -O /dev/null https://example.com/cron.php. This requests the page on schedule and discards the output, which triggers whatever the script does server-side.
What is the correct PHP path for a cPanel cron job?
Most cPanel hosts use /usr/local/bin/php, but some use /usr/bin/php or version-specific paths like /opt/cpanel/ea-php82/root/usr/bin/php. Check your hosting provider's documentation or ask support for the exact path.
How do I stop cPanel cron job emails?
Append >/dev/null 2>&1 to the end of the command to discard all output, or redirect to a log file with >> /home/username/logs/cron.log 2>&1 to keep records without the emails.
Need the expression itself? Build and test any cron schedule in our free visual generator — with live upcoming-run previews in Unix and Quartz formats.
Related guides
References
- cPanel Documentation — Cron Jobs — the official feature reference
- GNU Wget Manual — flags used in URL-based cron commands