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.

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

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

This should run once every 2 minutes or so.

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.

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

Jan 01 01:02:03 hostname crond[12345]: (username) CMD (php -q /path/to/ipanel/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.

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.

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

php -q /path/to/ipanel/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.

If running the cron job command manually seemed to work properly, then the problem is almost certainly one of the following: You have a typo in your cron job command in the crontab, but are typing it correctly when you run it manually, or 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 resolve this:

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 "ll /usr/bin/php", "ll /usr/local/bin/php", etc. until you find it. 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. Save the changes to your crontab and wait to see if the problem is resolved. You are mistakenly attributing a problem to the cron job, when in fact the cron job is working fine.

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.