I was trying to run cron.php via host provider, but I discovered that it only runs with authenticated users.
But I also discovered this great solution that allows cron to run by anonymous users: http://drupal.org/node/995514#comment-4373006
Now cron runs ok, once per hour
It is being run via HostMonster cPanel cron:
"-0 * * * * /ramdisk/bin/php5 -c home1/client/public_html/php.ini /home1/client/public_html/newsite/na/cron_user1.php"

But beyond the line informing that the cron was run properly, I get along with other line always this error:

(http:///?/home1/client/public_html/newsite/na/cron_user1.php): "Domain access failed to load during phase: bootstrap include. Please check your settings.php file and site configuration."

However my settings.php is configured correctly with these lines:

/**
* Add the domain module setup routine.
*/
include './sites/all/modules/domain/settings.inc';

This error in itself apparently does not cause any problems to the site, but maybe it can be avoided.
Any ideas?

Comments

agentrickard’s picture

Category: bug » support

This happens because Drupal's cron process expects to be run with a full HTTP request string. When one is not available, as in the direct cron code you are using, domain lookups fail.

See https://drupal.org/cron

One solution, if you have drush on the server, is to call cron via drush instead:

drush cc -l http://example.com

This warning is harmless in your case -- it means that all cron requests will run under your default domain. There is no simple way to disable it.

agentrickard’s picture

Title: Domain access failed to load during phase: bootstrap include. Please check your settings.php file and site configuration. » Cron without URL throws warning

Better title.

texas-bronius’s picture

Hi Folks-
We recently enabled elysia_cron on a project, and our watchdog is slammed with the same error message including Location: http:///. I think the two are correlated (in our case) and wanted to share this tidbit fwiw.
-Bronius

agentrickard’s picture

Status: Active » Closed (works as designed)

The instructions for setting up Drupal cron clearly state that you should pass a url value for this very reason.

https://drupal.org/node/23714

agentrickard’s picture

You can also disable this message in settings.php if you can't fix your cron script.

Add this to settings.php (at the bottom):


      // Show a warning to admin users, if enabled.
      // You may disable this warning by adding:
      // to the bottom of settings.php.
      $conf['domain_hide_errors'] = TRUE;
      
texas-bronius’s picture

Status: Closed (works as designed) » Active

@agentrickard- Would it be possible/appropriate in the testing for and falling back to default domain bit of domain init to also check against empty domain? You still want to throw error for bad bootstrap and for "legitimately unrecognized domains", but if the issue occurs widely enough that cron is called "from" http:/// for my or others' use cases, then handling it would squash all errors: It could still be helpful to provide documentation that says, "Oh by the way, call each specific domain's cron, if that's important to your application" but even that is probably an edge case.

Are there other reasons the failure at phase bootstrap might falsely report that settings.php was not configured, and is there a better or more specific test to run? Perhaps just the presence and absence of some constant defined only in DA's settings.inc would be a more direct "hey you didn't follow INSTALL.txt, you goof" checker.

-Bronius

agentrickard’s picture

Given that cron in Drupal requires a URL, I don't see the point. This is a configuration error.

agentrickard’s picture

And it certainly isn't getting any attention in 6.x

texas-bronius’s picture

For what it's worth, my empty requester is Location: https:/// (secure https, not http as reported earlier), but the site is not a secure site. Maybe I've got something else calling and coinciding?..

Also @agentrickard would it make sense instead of using empty($hide) to check on the value of $hide in the event someone wants to keep the definition in settings.php but just toggle it while troubleshooting:

      $hide = variable_get('domain_hide_errors', FALSE);
      if (user_access('administer domains') && !$hide) {
        drupal_set_message($error, 'error');
      }
      if (!$hide) {
        watchdog('domain', $error, NULL, WATCHDOG_ERROR);
      }
texas-bronius’s picture

Well dang it-- checking apache logs, looks like nagios is our (us- our, not you folks and me- our) culprit:

some.source.ip - - [16/Aug/2012:16:50:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
some.source.ip - - [16/Aug/2012:16:53:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
some.source.ip - - [16/Aug/2012:16:56:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
some.source.ip - - [16/Aug/2012:16:59:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
some.source.ip - - [16/Aug/2012:17:02:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
some.source.ip - - [16/Aug/2012:17:05:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
some.source.ip - - [16/Aug/2012:17:08:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
some.source.ip - - [16/Aug/2012:17:11:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
some.source.ip - - [16/Aug/2012:17:14:48 -0400] "GET / HTTP/1.0" 403 5152 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"

My two earlier questions are still valid: Can Domain Access only check for valid domains and, for confirming proper settings.php, include a constant in its settings.inc to look for?

agentrickard’s picture

Status: Active » Closed (works as designed)

No. These reports are designed to help you troubleshoot. You have ways to turn them off, as noted above.

They are largely for novice users, not advanced users, and their inclusion has made support much, much easier.

rogeriodec’s picture

Guys: the solution to # 1 is simpler than you might imagine: just create a cron task o cPanel:
curl http://example.com/cron_user1.php