Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I get this in the footer and I can't log in:
Fatal error: Cannot redeclare class InsertQuery_mysql in /Users/joachim/Sites/7-drupal/includes/database/mysql/query.inc on line 88
Comment | File | Size | Author |
---|---|---|---|
#24 | drupal-apc_redeclare_database-838744-24.patch | 633 bytes | baisong |
Comments
Comment #1
chx CreditAttribution: chx commentedIs this a fresh HEAD? What did you do to get that? etc
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedWe don't support HEAD to HEAD upgrades at this point. You will have to reinstall.
Comment #3
rogical CreditAttribution: rogical commentedFatal error: require_once(): Cannot redeclare class insertquery_mysql in /opt/difang/prod/qlkaixin/includes/database/database.inc on line 1717
caused by the following code:
Comment #4
marcingy CreditAttribution: marcingy commentedThis is not critical.
Comment #5
ScottyC CreditAttribution: ScottyC commentedThis error is critical for me, I can barely access anything. My site is down.
Comment #6
marcingy CreditAttribution: marcingy commentedThis is not a general problem therefore it is not critical. Please provide information about your install to help use trace the problem.
Comment #7
ScottyC CreditAttribution: ScottyC commentedHi marcingy,
This is more an apology and note for others. I wasn't aware that my rating of the issue would alter the rating for the issue in general. Sorry about that, I hope I haven't broken any group rules. I have had a quick look for some but to no avail. I am using Version 7.7 and had just installed the Collapse Text module and had rebooted my apache server. I was repeatedly getting this error and I could only occasionally access only the home page of my site before receiving the above error (hence my critical rating). In trying to provide you with some info from my error logs I rebooted the apache server again and low and behold, problem gone. Not sure why? I don't have the time to care about why either, just happy everything works again.
Thanks
Comment #8
Chi CreditAttribution: Chi commentedI got the same error after updating from 7.0 to 7.9.
Comment #9
Chi CreditAttribution: Chi commentedThe error goes away when I disabled APC extension in .htaccess.
php_flag apc.cache_by_default Off
Comment #10
Chi CreditAttribution: Chi commentedThere is a common issue: http://www.google.ru/search?q=Autoloader+APC+Cannot+redeclare+class
Comment #11
chx CreditAttribution: chx commentedAs pointed out in #10, not our problem. Try apc.include_once_override = 0
Comment #12
1kenthomas CreditAttribution: 1kenthomas commentedSee
http://stackoverflow.com/questions/4575341/php-with-apc-fatal-errors-can...
for more clarification on the nature of the issue. In particular, note that in addition to the apc.include_once_override = 0 solution, the underlying problem may be fixed in subsequent versions of APC.
Comment #13
phayes CreditAttribution: phayes commentedJust to be clear, to fix this edit your php.ini file (or /etc/php/conf.d/apc.ini file) and add the following:
apc.include_once_override = 0
Comment #14
phayes CreditAttribution: phayes commentedFor those of you still running into this issue: We've found XCache to be a good alternative to APC
Comment #15
pamu777 CreditAttribution: pamu777 commentedapc.include_once_override = 0 does not help to me.
and I tried below, but still that does not help me. anyone know how to fix?
apc.include_once_override = 0
apc.canonicalize = 0
apc.stat = 0
Comment #16
dman CreditAttribution: dman commentedThanks for this thread.
It gave me enough clues to confirm it seemed to be related to APC.
I'm running Acquia Dev Desktop (which has APC on by default) an on importing a new site, the site loaded once, then subsequent pages threw this error.
Restarting the Acquia stack made the problem go away.
Comment #17
damien_vancouver CreditAttribution: damien_vancouver commentedI had this error on Debian Linux after restarting Apache using the "apache2ctl graceful" command.
The comment in #16 about restarting the whole dev stack gave me a hint. I used "/etc/init.d/apache2 restart" to restart the entire apache process, and the error went away!
Comment #18
omega8cc CreditAttribution: omega8cc commentedNo extra settings and no restarts will help. Upgrade your APC to 3.1.14 to avoid this known APC bug.
Comment #19
chilic CreditAttribution: chilic commentedI using APC 3.1.9
Options on:
apc.include_once_override = 0
apc.canonicalize = 0
apc.stat = 0
get fatal error.
Comment #20
omega8cc CreditAttribution: omega8cc commentedThis is not a Drupal issue but APC bug. Please read #18
Comment #21
chilic CreditAttribution: chilic commentedO! Thanks i see my mistake.
Comment #22
damien_vancouver CreditAttribution: damien_vancouver commentedGetting this error consistently after a server upgrade now. The D7 site in question starts out fine after apache restart but soon WSOD's with our old friend:
[Tue Mar 05 12:27:47 2013] [error] [client ww.xx.yy.zz.] PHP Fatal error: Cannot redeclare class InsertQuery_mysql in /home/example/includes/database/mysql/query.inc on line 87
The APC version mentioned in #18, v3.1.14 with the memory fix ,has been pulled due to other problems in it. (See #1914294: APC 3.1.14 disappeared from PECL for more info about this).
So for now (March 2013) we are back to no working APC fix. I have found one workaround that always does the trick for me. Set your apc.shm_size=32M and no larger. 32M is the default size and for some reason the error is never triggered for me if I stick to that. My guess is that the default size does not cause the bug, which would maybe explain this problem being one that is hard to reproduce and fix.
Of course 90%+ of your PHP objects will probably be cache misses.. but that's a lot nicer than WSOD!
Here is my Debian /etc/php5/conf.d/apc.ini file that is working for me. It might work for you.
Please post here if you still get the errors after setting your config to use apc.shm_size=32M, and I will edit this post accordingly.
Now we wait for APC 3.1.15 to be released. Then maybe wait an extra week just to be sure ;)
Comment #23
willhise CreditAttribution: willhise commentedHad the same issues. Tried all the solutions posted here. Dropping shm_size to 32M does work, but what's the point? APC is basically off at that point. I'm also not sure if this actually fixes the issue or just hides it since so little is actually in APC.
APC 3.1.14 has been pulled as stated above, so we're back to 3.1.13.
Here's what worked for us, based on the last comment on this post: http://help.getpantheon.com/pantheon/topics/fatal_error_require_once_can...
APC version 3.1.13
PHP 5.3
allow_call_time_pass_reference = on
We are tracking down all the places in the code that this happens and fixing them.
Comment #24
baisongHere's a patch that prevents the redeclare error from happening.
Based off of the solution linked to in comment #23
We were running into the issue on OpenScholar with variable apc.include_once_override set to 0, APC version 3.1.3p1, in an Acquia environment that can't be upgraded.
Comment #25
omega8cc CreditAttribution: omega8cc commentedBTW: since APC looks deprecated already, you should switch to Zend OPcache if you can:
https://twitter.com/omega8cc/status/348123637913624576
https://twitter.com/omega8cc/status/348121239342182400
It has an extra config options to prevent issue like this, and we have already switched to it in the BOA stack.
Comment #26
ianwesty CreditAttribution: ianwesty commentedFor anyone having the same issue with Acquia Dev Desktop Control Panel
Go to your php.ini in /Users/[username/Applications/acquia-drupal/php5_3/bin/
Search for apc.enabled=1
Change it to apc.enabled=0
Restart Acquia Dev Desktop and all should be fine.
Comment #27
ianwesty CreditAttribution: ianwesty commentedFor anyone having the same issue with Acquia Dev Desktop Control Panel
Go to your php.ini in /Users/[username]/Applications/acquia-drupal/php5_3/bin/
Search for apc.enabled=1
Change it to apc.enabled=0
Restart Acquia Dev Desktop and all should be fine.
Comment #28
ianwesty CreditAttribution: ianwesty commentedFor anyone having the same issue with Acquia Dev Desktop Control Panel
Go to your php.ini in /Users/[username]/Applications/acquia-drupal/php5_3/bin/
Search for apc.enabled=1
Change it to apc.enabled=0
Restart Acquia Dev Desktop and all should be fine.
Comment #29
edutrul CreditAttribution: edutrul commentedIn my case, We didn't have apc enabled,
So What I did was the following:
in includes/database/mysql/query.inc
I added:
Putting the above code resolved the bug for me.
But I think this requires further investigation in the core. Since require_once shouldn't call the same class twice?
Hope this helps somebody
best regards
Comment #30
qqboy CreditAttribution: qqboy commented#9 chi helped me thanks
Comment #31
SproetS CreditAttribution: SproetS commentedRestarting Acquia DevDesktop (#16) helped me to be able to click trough the site again.
#26 (and #27 and #28) made the error go away (or hide?).
Thanks!