My iPanel/iHost cron job is not running. Why is this?


My iPanel/iHost cron job is not running. Why is this?


Please check each item in this list to ensure that your cron jobs (and cron) are set up correctly.

  1. Did you set up the cron job? If not, please do so. The command for the cron job is:

    php -q /path/to/ihost/cron/cronjob.php

    This should run once every 2 minutes or so.

  2. Is your cron job still intact? Double-check to make sure that it exists, either in /etc/crontab or in your per-user crontab. Sometimes another user or application may inadvertently remove a cron job.

  3. Check /var/log/cron and check whether cron is actually attempting to run the iPanel/iHost cron job. If it is, you will find entries looking something like:

    Jan 01 01:02:03 hostname crond[12345]: (username) CMD (php -q /path/to/ihost/cron/cronjob.php)

    Make sure you pay attention to the date/time of any matching lines you find; if the cron job is scheduled to run every few minutes, make sure it's run within the past few minutes. If not, your cron daemon is not running it and you'll need to ask your admin to troubleshoot this for you.

  4. If the cron log in /var/log/cron shows that the cron job is being regularly run as it should, the problem is likely that your PATH environment variable in /etc/crontab does not include the path in which your PHP CLI binary is installed. In this case, change the php -q in the cron job command to the full path to PHP, i.e., /usr/bin/php -q or /usr/local/bin/php -q or wherever it's installed on your server.

  5. Try running the cron job command manually in debug mode. For example, run:

    php -q /path/to/ihost/cron/cronjob.php --debug --verbose --force

    That should output a lot of information. If it only outputs an error message and then exits, there is probably a problem with your PHP configuration and you'll need to ask your admin to diagnose this. If your admin determines that it appears to be an iPanel/iHost issue, open a ticket including the output of the above command.

  6. If running the cron job command manually seemed to work properly, then the problem is almost certainly one of the following:

  • You are mistakenly attributing a problem to the cron job, when in fact the cron job is working fine.
  • You have a typo in your cron job command in the crontab, but are typing it correctly when you run it manually.
  • You are not specifying the full path to your PHP interpreter, and your cron search path differs from your shell search path. This is common on DirectAdmin servers, among others.

    To update your cron job with the full path to PHP:

    Locate PHP on your server. On most servers, running which php will give you the path to PHP, for example /usr/local/bin/php. If you get which: command not found then you'll need to manually look for the PHP interpreter on your server. Usually it's located in /usr/bin/php, or /usr/local/bin/php. On some systems it may alternately be named /usr/bin/php4 or /usr/bin/php5. You can test each location by running ls /usr/bin/php, ls /usr/local/bin/php, etc. until you find it.

    Next, in your cron job command, replace php -q with /usr/local/bin/php -q, replacing /usr/local/bin/php with the correct path to PHP which you found in the previous step.

    Finally, Save the changes to your crontab and wait to see if the problem is resolved.

If you still cannot resolve the problem, open a ticket containing the output from step 5, a description of the symptoms you're seeing, and a description of what you've done to resolve the problem.