Undefined index errors when running cron.php I am getting a slew of errors when I attempt to run a cron job following my hosting company's instructions. From researching the errors, I suspect the instructions are wrong. But their support is telling me this is a development issue and they can't help me. So I hope someone here can tell me the correct way to run cron in this environment.

The site is running without error. Cron runs successfully by using "admin/reports/status/run-cron" or by using the URL provided for running cron from outside the site.

The instructions say to use the following command:

cd /home/username/public_html &amp;&amp; php /home/username/public_html/cron.php >/dev/null 2>&amp;1
 

This fails silently, meaning that nothing happens that I can see, but the status report does not indicate that cron has run. So I removed the ">/dev/null ..." part in order to allow the system to send me a result e-mail. Thus the command I'm using now is:

cd /home/username/public_html &amp;&amp; php /home/username/public_html/cron.php


When this command executes, I get an e-mail with hundreds of errors, mostly like:

Notice:  Undefined index: argc in /home/username/public_html/includes/bootstrap.inc on line 3407
Notice:  Undefined index: SCRIPT_NAME in /home/username/public_html/includes/bootstrap.inc on line 1622


I found a forum post about the same kind of problem, and the offered solution was to "Use a URL to cron.php with wget or curl." Unfortunately, my Unix is rusty and I don't know how to do that.

Can someone suggest how to modify the command in the host instructions so that cron will run correctly?

Thanks for your help.
You shouldn't run cron.php throught php cli. basically you should have a line like this in your crontab file:

0 * * * * wget -O - -q -t 1 http://www.example.com/cron.php

but you also need to append security token to the url.

by reading Configuring cron jobs using the cron command page you will get a better idea of how it works.