Posted by nhchau on December 12, 2008 at 2:50am
I upgraded my Drupal from 6.7 to 6.8. After upgrading, Cron does not run properly. I tried to run from shell: "php cron.php" and got the following error:
Status: 400 Bad Request
X-Powered-By: PHP/5.2.6
Content-type: text/html
My PHP version:
PHP 5.2.6 (cgi-fcgi) (built: Nov 29 2008 22:35:16)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
Please help me to solve this error.
Comments
The Drupal's cron run well if
The Drupal's cron run well if I clicked to this link: .../admin/reports/status/run-cron but cannot run from command line as "php cron.php"
C.
Same situation here. After
Same situation here. After upgrade 6.6->6.7->6.8 cron stopped work. Cron log at webhosting looks ok, if I "run" /cron.php from my browser it is proccessed successfuly..
Patch it
Please go to this URL http://drupal.org/node/346285 and apply patch described there. I patched, and it works for both Drupal 6.8 and Drupal 5.14. Hope this helps.
The patch code is here: http://drupal.org/files/issues/drupal-5-empty_http_host_support-1.patch
C.
How Do You Apply The Patch?
How is this patch applied? Is this code copied into the "cron.php" file or somewhere else?
Apply the patch
In Drupal 6.8, edit file /includes/bootstrap.inc, go to line 279 or search for drupal_valid_http_host() function, change the function's original code:
$_SERVER['HTTP_HOST'] = strtolower($_SERVER['HTTP_HOST']);
return preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $_SERVER['HTTP_HOST']);
to
if (empty($_SERVER['HTTP_HOST'])) return true; // Add this line
$_SERVER['HTTP_HOST'] = strtolower($_SERVER['HTTP_HOST']);
return preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $_SERVER['HTTP_HOST']);
This patch also applies well to Drupal 5.8: edit the same file, go to line 242 or search for drupal_valid_http_host() function repeat the above action.
Good luck.
C.
Apply The Patch
nhchau
That worked & the cron is working again.. It was a little confusing at first, I didn't know if I was supposed to leave // in the code or not. All is good.
Thanks for the help.
And now it's giving me "HTTP
And now it's giving me "HTTP request status" every single time the Cron is run while previously it was only doing it now and again
Press Release 001 | Do Follow 001
Worked for me
Thanks nhchau, your suggested change to bootstrap.inc worked for me with my web hosting provider (Logicweb).
Apply the patch
Thank you very much. This helped me a lot.
Cron not working
My hosting provider sends me some canned support: "Please note that you will need to update the "$HOME" object in your Cron Job to your hosting account's full path."
Same Problem, fixed without patching
It stopped working on all of my installations when I upgraded on day 0. I just changed my cron job to instead of running "php cron.php" it now does:
cd/tmp ;
wget http://mysite/cron.php ;
rm cron.php
That worked!
I'm running 6.8 and it works.
you can put it all in one line in CPanel like:
cd/tmp; wget http://mysite/cron.php; rm cron.php__________________________________________________________
http://throk.net | @throk
Thanks for the info and
Thanks for the info and patch.
Sites running again now.
Pity that I didn't suspect drupal was to blame and spent two hours trying to troubleshoot the cpanel crontab. I was just about to fire off an email to webhost support asking them reset my account. Luckily I did a quick search here before doing that.
Cheers.
Everything I say is opinion, even if interpreted as fact.
Sometimes I may be inaccurate or *GASP* wrong!
Sometimes I attack Drupal due to frustration. Get over it.
subscribing
I am having problems with a updating to D6 too
--
Creating an activelyOUT community of LGBT professionals
http://SocialNicheGuru.com
Creating gurus to deliver the right product and the right message to the right niche at the right time