zizhost
Automation

Cron jobs

Schedule recurring PHP scripts from the hosting panel.


Schedule a cron from the hosting panel

  1. Open the hosting panel from your dashboard.
  2. Click Cron Jobs.
  3. Pick a schedule from the dropdowns (every five minutes, hourly, daily…) or type a five-field crontab line.
  4. Set the command. The hosting panel exposes php directly, so you do not need an absolute path.
  5. Save.

Run a PHP script every hour

0 * * * * php $HOME/public_html/cron/refresh-cache.php >> $HOME/cron.log 2>&1

Tips

  • Redirect output (>> and 2>&1) to a log file inside your home directory. Without it, errors are silent.
  • Use the $HOME environment variable instead of hard-coding the path. It stays valid across plan changes.
  • The working directory is your home, not public_html.
  • The panel may rate-limit how often a cron can fire. Once a minute is the floor on most installs.

Detect cron context

if (php_sapi_name() === 'cli') {
    // Running from cron
}

HTTP-trigger alternative

If the panel’s cron is restricted to longer intervals than you need, expose a small PHP endpoint at /private-cron.php protected by a long random query token, and call it from an external scheduler like cron-job.org or GitHub Actions on the cadence you want. Verify the token inside the script and refuse anything else.