Implemented cron to run once a day, no user interaction. This is the output that I get
CODE:
Warning: parse_url(http://) [function.parse-url]: Unable to parse URL in .../sites/all/modules/boost/boost.module on line 536
Warning: Cannot modify header information - headers already sent by (output started at .../sites/all/modules/boost/boost.module:536) in .../includes/bootstrap.inc on line 620
Warning: Cannot modify header information - headers already sent by (output started at .../sites/all/modules/boost/boost.module:536) in .../includes/bootstrap.inc on line 621
Warning: Cannot modify header information - headers already sent by (output started at .../sites/all/modules/boost/boost.module:536) in .../includes/bootstrap.inc on line 622
Warning: Cannot modify header information - headers already sent by (output started at .../sites/all/modules/boost/boost.module:536) in .../includes/bootstrap.inc on line 623
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | boost_base_url.patch | 934 bytes | rsvelko |
| #13 | drupal.org_boost-base_url.patch.txt | 579 bytes | rsvelko |
| #12 | boost-base_url.patch | 540 bytes | rsvelko |
| #9 | INSTALL.txt.patch | 669 bytes | mikeytown2 |
Comments
Comment #1
mikeytown2 commentedWhat if it attempted to set $base_url by first by trying $_SERVER['SERVER_NAME']. If that fails then extracting it from the .htaccess file under the mod_rewrite section or from sites\default\settings.php. If those fail, hit the DB and try to get it from the variables table where name = site_mail or boost_file_path. To validate results get sever IP with $_SERVER['SERVER_ADDR'] and compare against gethostbyname("One of the above methods"). Is this the right approach?
Comment #2
mikeytown2 commentedThis should work for me, gotta wait till tomorrow for my scheduled cron to run. $base_url doesn't have a trailing / at the end correct?
Comment #3
rsvelko commentedguys the $base_url is documented here: http://api.drupal.org/api/global/base_url/6
and from there I saw that says sth about conf_init...
So, I remembered that in the settings.php there is such a variable - $base_url
and I've uncomented and set it up... and now when I use drush it gives no more errors - but the status report does not say that cron has just been run... and running it via the site gives an error "Cron run failed" ...
Not sure what to patch to get this fixed - drupal core settings file or boost?
Should $base_url be accessible always or should boost check for it and if not ok default to sth from php globals or other....??
Comment #4
mikeytown2 commentedI'll test this out.
This error and correct fix (if this does indeed fix it) should be added to the txt files that comes along with the module.
Comment #5
rsvelko commentedThink I figured it out - due to the php errors my cron semaphore var is not flushed - cron thinks he is being run constantly ...
So after cleaning the var with devel module I guess it will be fine - both cron and boost.
Comment #6
rsvelko commentedYes, cron is now fine - after semaphore var flushed and after the reason for the crash is gone - the $base_url is now set in settings.php...
So, it was not set for the starter of this issue cause he was using drush or wget or sth like that ...
Until boost is patched everyone using wget or drush or curl should set up his settings.php file.
Am I correct?
Comment #7
mikeytown2 commentedno, this should be part of the documentation; modifying the settings.php file is something that needs to be done in order to get boost running at full steam. Just like editing the .htaccess file.
Comment #8
mikeytown2 commentedediting settings.php fixes this error; it's the right way to do it because of potential multisite issues. Needs to be added to the modules documentation.
Comment #9
mikeytown2 commentedComment #10
mikeytown2 commentedis there any way to check that $base_url is set in settings.php, warn the user if its not?
Comment #11
mikeytown2 commentedadding tag
Comment #12
rsvelko commentedI have a better solution - in a few words:
use the new drush-HEAD and no such problems as above. The new drush bootstraps drupal to the apropriate level for each command (in our case cron) - so now cron and boost have $base_url somehow ...
Actually I can only suppose why it is working but IT IS :)
The only thing left is to patch a bit INSTALL.txt - here is my version of the above patch attached.
Comment #13
rsvelko commentedin two words : it was drush's bug not boost's and it got fixed in drush.
the final docs patch attached - minor fix for clarity
Comment #14
rsvelko commentedComment #15
mikeytown2 commentedGoing to link to this post from install.txt
Editing settings.php
settings.php is usually located in the sites/default directory. Editing it can be a little tricky because of permissions. Follow the steps below, and you should be fine.
You can change permissions via ftp as well. Here's a guide for FileZilla.
http://affiliate-minder.com/internetmarketing/changing-file-permissions-...
Comment #16
mikeytown2 commentedpatch applied
Comment #17
rsvelko commentedas I said in #13 here - drush was fixed so when you invoke cron via it - no such bug.
When you invoke cron.php from a crontab file with wget and with $base_url unset in your settings.php file - still no problem ...
So I am a huge fan of an easier to install boost and so - please if the rest cannot duplicate this issue close it without putting unnecessary text in install.txt...
(My patch above is necessary I think. For people with older drush-es)
Comment #18
mikeytown2 commentedRun cron via the command line & it throws those errors.
which is the default way on a lot of cron management interfaces. Using wget would work because the URL is there; Poormanscron would work as well. It's an error that doesn't get reported that often because it's not easy to get the output from running cron via command line. Having $base_url set is important for clearing out the correct subdir inside the cache folder; boost_cache_expire_all() uses it. I know the installation has a lot of steps, but this is an important one that can effect how boost works. I would rather have it complicated and work for everyone, vs getting bug reports in the issue queue. I don't like making things more complicated but sometimes it has to be done.
Comment #19
rsvelko commentedactually the problem beneath all this is more general - "How to know the site url when invoking from cmdline?"
After I checked why drush does not output an error like the one I see with "php5 ./cron.php" - it turned out that drush sets the $base_url to "default" and then boost gets tricked to "rm -fdr cache/default" which is harmless cause this dir does not exist....
For now lets patch the INSTALL file with instructions on how to set the $base_url.
The latest CVS version of INSTALL.txt needs a bit tweaking - -here is my proposition attached.
Comment #20
rsvelko commentedComment #21
mikeytown2 commentedWe can still require step #7, but we can also make boost smarter.
After looking into #446370: cache directory not set to default on initial install - throw notice on status page if this happens, I think this is a fairly safe way to do this.
Comment #22
rsvelko commentedsorry for not checking this myself but:
what are
variable_get (boost_file_path)
and
boost_cache_directory(NULL, FALSE)
supposed to return specifically? Give examples.
And are you sure that when not set $base_url = "http://"?
Comment #23
mikeytown2 commentedboost_file_pathis set by Cache file path: on the performance page. boost_cache_directory(NULL, FALSE) is what boost uses for its default setting of that variable; it defaults to "cache/www.example.com", www.example.com being the site. Thus all I do is strip offcache/and I got the key part of the base URL. Should I throw a watchdog warning or notice as this is not 100% foolproof; if the site is using the defaults then it will work 100% of the time.Comment #24
mikeytown2 commentedWhat does drush set the $base_url variable to? default? can you check this for me? I'm positive $base_url gets set to "http://" if run from the command line.
http://api.drupal.org/api/function/conf_init
Comment #25
mikeytown2 commentedHere's the proposed addition to the boost_cache_directory() function.
Comment #26
mikeytown2 commentedCommitted & made the cache dir a global variable. See http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/boost/boost... for changes made.
Comment #27
rsvelko commentedok, if users report problems after these patches - only then we will take further actions. Will remember to test myself when I need to run cron ... Good work Mikeytown2 .