Since a few days, maybe since D6.14 or some module updates, not sure about the precise timing, my logs are full of lines such as the following one:
[27-Oct-2009 03:35:59] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required './sites/all/modules/cck/theme/theme.inc' (include_path='.:/usr/share/pear:/usr/share/php') in /PATHTOMYSITE/sites/all/modules/cck/content.module on line 177
Disabled some modules I thought could cause this but haven't found the culprit. Any ideas?
[Btw, there's a related post #615760: Enabling views crashes whole site - only plain text error message (smoking ruin) for the case that this is a D6.14 and not CCK problem.]
Comment | File | Size | Author |
---|---|---|---|
#29 | 616282-memcache-theme-registry.patch | 1.07 KB | longwave |
#22 | memcache_theme_registry.patch | 949 bytes | robertDouglass |
#20 | memcache-n616282.patch | 954 bytes | DamienMcKenna |
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedI think both issues are the same. So marking this one as a dup of #615760: Enabling views crashes whole site - only plain text error message (smoking ruin)
AFAICT, CCK code is correct. The file should be there (it is included in the package), and it should be accesible with that statement (Drupal executes from the Drupal root, and ./sites/all/modules/cck/theme/theme.inc is relative from there), unless something odd is happening in your system. Maybe the file is not there (caused while upgrading from an earlier version? ), or maybe another module has changed the current working directory, or maybe it is a filesystem issue, permissions?
Comment #2
markus_petrux CreditAttribution: markus_petrux commentedComment #3
Vacilando CreditAttribution: Vacilando commented@markus_petrux, in fact, as thomasmurphy noted (at #615760: Enabling views crashes whole site - only plain text error message (smoking ruin)) the issue I've reported above is related to CCK while his is about Views.
Not wanting to keep toggling the status, could I ask you to reconsider and reopen this issue.
Indeed,
./sites/all/modules/cck/theme/theme.inc
is there on the server; checked.Filesystem perms are just like for any other file there.
No other errors like that - always this one error msg repeated in the log (see above).
If it were any less important module I'd disable it until a new version, but I obviously need CCK. So what do you recommend - what can I check for, how to find out what causes this. Thanks.
Comment #4
markus_petrux CreditAttribution: markus_petrux commented@vacilando: looking at that issue, moved to the Views queue, you'll see how merlinofchaos also states it's not a problem with the module, but something else. He says, it's user error. I also add that it could be caused by another software component, or even hardware related. Please, read my second paragraph in #1.
I'm switching the issue to "fixed" so that it is more visible in the queue, but still nothing to do with CCK itself, otherwise it would be failing to everyone else, which is not the case. The require_once invocation is correct. So the problem may come from something else.
- Check the file is there.
- Check file permissions.
If that's seems correct, then it could be that another module has changed the current working directory of the process. We (and any other code in Drupal) assume the current working directory is the same directory where Drupal itself is installed, aka Drupal root. So we should be able to use relative paths that work everywhere.
Line 177 in content.module is part of content_theme() function. This is implementation of hook_theme() in content module. This function is invoked when Drupal rebuilds the Theme registry. To check if the current working directory is still Drupal root, you could do this:
The quickest way I know of to force a Theme registry rebuild is from the icon menu in Administration menu.
Comment #5
Vacilando CreditAttribution: Vacilando commented@markus_petrux, thanks for your exhaustive answer.
Yes, I did read your 2nd paragraph in #1, and answered it in my 3rd paragraph in #3 :-)
The solution that worked in the other issue does not apply to me as all of the files are indeed uploaded.
This leaves just one possibility, that is that something else is altering the path.
But what? What kind of modules could tinker with the current working directory? Perhaps Memcache API module which I am using? Other ideas?
Btw: all modules are up to date on my system.
Yes, I did clear the theme registry.
Thanks a lot.
Comment #6
markus_petrux CreditAttribution: markus_petrux commentedFirst thing would be to try the code I posted in #4. That should reveal if the cwd has been changed, and where it has been set.
Another thing would be to look at the Drupal logs and find these errors. Are all related to the same URL? Can you see a pattern here?
Another thing: scan the code of all module in your site for code that may alter the current working directory. Function chdir()?
Another thing: if you know how to reproduce the error, then start a debug session to find out where the cwd is being changed. This could be done adding drupal_set_message(__FILE__ .' - '. __LINE__ .' - '. getcwd()) here and there.
Comment #7
Vacilando CreditAttribution: Vacilando commentedThanks for all recommendations. I think I've found the problem thanks to backtrace in PHP. The problem seems to be caused by Memcache API. Moving this to that module's issue queue.
Comment #8
kenorb CreditAttribution: kenorb commentedThe same problem.
When cache is cleared, memcache trying to execute theme() function on shutdown:
On Apache, current dir is changed on shutdown and it's not pointing to Drupal directory (it's by design).
Possible solutions:
- this theme() function should be removed
- this function shouldn't be called on shutdown
- directory should be changed back to Drupal root, but it doesn't make sense to theme something on shutdown
Comment #9
Equinger CreditAttribution: Equinger commentedSubscribed.
Comment #10
Macronomicus CreditAttribution: Macronomicus commentedSame thing here. >_<
Comment #11
iestevao CreditAttribution: iestevao commentedI've detected a few days ago the same error after installing memcache and enable statistics at the bottom of each page.
I have Drupal 6.16 and Memcache Admin 6.x-1.4 installed.
Add the following condition to theme registry:
Comment #12
chrishaslam CreditAttribution: chrishaslam commentedI've experienced the same issue here, disabling 'show memcache statistics at the bottom of each page' at admin/settings/memcache fixed the issue for me.
Comment #13
Daniel Norton CreditAttribution: Daniel Norton commented++
Comment #14
kenorb CreditAttribution: kenorb commentedThe same problem again. This time my website is broken and is not loading.
Why you theme anything on shutdown?
Comment #15
webwriter CreditAttribution: webwriter commentedSame issue. Subscribe.
Comment #16
webwriter CreditAttribution: webwriter commentedOk, I've now spent HOURS trying to put my site back together after this error. No matter what I do, turning on CCK now gives me the error and whitescreen.
I do not see a memcache admin table in my database. I have deleted the module code, removed the reference to it in my system table, removed the info from my settings.php file and I am still unable to turn CCK on.
Where else has this module modified my installation?
Argh!!
Nevermind, I'm going to restore from 2 nights ago backup. This is just insane.
Comment #17
dalejung CreditAttribution: dalejung commentedHere's the fix that iestevao posted but written as a simple guard.
http://bitbucket.org/dalejung/hookdrupal/changeset/416545384c68
Comment #18
kenorb CreditAttribution: kenorb commentedComment #19
kenorb CreditAttribution: kenorb commentedComment #20
DamienMcKennaHere's dalejung's change as a patch file.
Comment #21
eric.chenchao CreditAttribution: eric.chenchao commentedSubscribed
Comment #22
robertDouglass CreditAttribution: robertDouglass commentedI don't think we should be calling theme_get_registry() from our stats shutdown function. So if the theme function ain't there, we get the heck out and just don't show stats.
Comment #23
longwaveThe patch in #22 doesn't work, as the theme_get_registry() function should always available by this point; we also need to ensure the registry is not empty to avoid the error, which the patch in #20 does - in D6, theme_get_registry() is just a static cache function, it doesn't invoke any hooks.
Devel uses the same approach in its shutdown handler: http://drupalcode.org/viewvc/drupal/contributions/modules/devel/devel.mo...
Marking #20 as RTBC for D6. Is this also an issue in D7? theme_get_registry() is more complicated there and I'm not sure the same fix is viable.
Comment #24
bibo CreditAttribution: bibo commentedsubscribe.
It seems I have (almost) the same error with the latest 6.x-1.x-dev (and 1.6):
require_once(./sites/default/modules/contrib/date/date/date.theme) [function.require-once]: failed to open stream: No such file or directory in file xxxx/sites/default/modules/contrib/date/date/date.module on line 260.
It stops when i disable memcache_admin. I wonder why there arent more people reporting the same issue?
Comment #25
geerlingguy CreditAttribution: geerlingguy commentedSame problem here. Annoying as heck. I'll try the patch in #22 and see if that fixes it.
[Edit: Patch in #22 didn't fix the problem... but disabling memcache_admin did. Go figure. This seems to happen only when I clear all the caches via admin_menu, or when my cron script hits the cron.php file.]
[Edit 2: (thanks to longwave's suggestion below) Patch in #20 fixes the problem.]
Comment #26
longwave@geerlingguy: the patch in #22 doesn't work, try #20 instead.
Comment #27
forestmonster CreditAttribution: forestmonster commentedSubscribing, thanks.
Comment #28
Jeremy CreditAttribution: Jeremy commentedI confirmed that a similar patch is in the devel module, and applied it locally:
http://drupal.org/cvs?commit=438212
However in further testing, I realized that the stats were _never_ showing up, so I backed the patch back out:
http://drupal.org/cvs?commit=438216
There appears to be another unrelated issue in which the theme is getting broken, not introduced by this patch (it happens with or without this patch being applied.)
Comment #29
longwave@Jeremy: your commit didn't work because the logic test is backwards. The attached patch reverses this and fixes the problem.
The easiest way to test this is with both CCK and Memcache installed on a site, disable the statistics at /admin/settings/memcache, save changes, enable the statistics and save changes again. Without the patch, a require_once error is logged to the watchdog, but with the patch in place the error does not occur.
Comment #30
stacysimpson CreditAttribution: stacysimpson commentedThis error started showing up on our site after installing memcache. I can confirm that the patch in #29 resolves the issue for our scenario.
Comment #31
mkinnan CreditAttribution: mkinnan commentedI can also confirm that I started getting this error as soon as memcache was installed. The patch in #29 was applied and the error is now gone.
Comment #32
catchCommitted this to 6.x, moving to 7.x in case it's also needed there.
Comment #33
catchCommitted to 7.x.