• Resolved conradude

    (@hellodracon)


    Hello,

    I have this error that just appeared and causes the site to brake.

    [02-Oct-2024 10:33:40 UTC] PHP Fatal error: Cannot declare class WP_Object_Cache, because the name is already in use in .../wp-content/plugins/apcu-manager/includes/api/object-class.php on line 18

    The issue appeared after I fixed something in an override where we kept on using $product->id instead of $product->get_id(); That’s not really related I guess but I think it blocked the error before and right after I fixed it, the WP_Object_Cache appeared.

    I deactivated the apcu manager plugin in the meantime. Any idea what causes this ? I thought it could be because of another cache plugin but I have only one (Cloudfare) and tried to deactivate it but it doesn’t change anything.
    Thank you

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Pierre Lannoy

    (@pierrelannoy)

    Hello @hellodracon !

    Sorry to hear that…

    You’re definitely right: it can come from another object cache plugin which is called directly and before WordPress load the object-cache.php file. To be honest, I have no idea how such a case could arise.

    Do you have other issues with your site that can be linked (or not)?

    Thread Starter conradude

    (@hellodracon)

    Hello Pierre and thank you for answering that quick.
    I don’t think there’s other issues linked to this. The only thing I see in the debug.log is this error again and again (yet I wasn’t seing this error before fixing the previous bug, meaning some other errors might exist but not being shown). As I said, no other cache plugin except the Cloudflare’s official one and I tried to deactivate it in vain.
    Would it be useful to delete the whole plugin through FTP (since I can’t activate it without getting an error making it impossible to use the site) and reinstall it ? Or would it be a waste of time anyway ?

    Plugin Author Pierre Lannoy

    (@pierrelannoy)

    Yes, I think it would be interesting to remove the wp-content\plugins\apcu-manager folder AND the wp-content\object-cache.php file to see what going on.
    Then, if there’s no error, no “strange” things, reinstall APCu Manager…

    Thread Starter conradude

    (@hellodracon)

    Hello again,
    I don’t have wp-content\object-cache.php Is that normal ?
    I tried to delete the apcu-manager folder and reinstall it but I get the same error.

    Plugin Author Pierre Lannoy

    (@pierrelannoy)

    This is not “normal” at all: this file is created by APCu Manager and without it, nothing can work…

    This may reveal a wider problem affecting your entire site… Has APCu Manager worked before on this site or has it never worked properly?

    Thread Starter conradude

    (@hellodracon)

    Ok so I had a look at a backup and saw this object-cache.php. I copied it and put it again in wp-content, tried to activate the plugin but still got the issue.

    The thing is, when trying to delete the plugin and reinstall it, it didn’t re-create object-cache.php. That’s a problem, right ? It should have created a new one ?

    Edit: to answer, it was working right yes, but I think there was the object-cache.php file at the time and it has been deleted somehow

    • This reply was modified 1 month, 3 weeks ago by conradude.
    Plugin Author Pierre Lannoy

    (@pierrelannoy)

    Yes, it should. And you can’t just restore it from a backup as this file is actually “controlled” by WordPress itself.

    Has APCu Manager worked before on this site or has it never worked properly?

    Thread Starter conradude

    (@hellodracon)

    Yes it used to work great. I think I just deleted it by accident while fixing the other bug.
    What can I do to fix this then (since I can’t restore it from a backup) ?
    thank you for you help, I feel dumb right now.

    Plugin Author Pierre Lannoy

    (@pierrelannoy)

    To be honest, I don’t think it’s *your* fault. The fact that activating the plugin cause the specified issue indicates that something else (may be: theme, plugin, mu-plugin or personal development) is “preempting” WordPress to correctly use cache. And it do it by forcing the load of the WP_Object_Cache class before it must be.

    Have you noticed that this issue has occurred after you installed a new plugin, writen some lines of code, changed your theme, etc. ?

    Thread Starter conradude

    (@hellodracon)

    I meant it’s my fault because I think I’ve probably deleted object-cache.php by accident the day the plugin stopped working. That day, I discovered this error (that wasn’t here before since object-cache.php was there) but didn’t realize I deleted the file at that time.
    Nothing else happened (except this fix I told about before, but nothing connected).

    Do you have an idea what I should do ?

    Also, we had a problem with the plugin wpml and had links error in our different homepages (there were mixed up links between languages). And it looks like this wpml bug disappeared at the same time the apcu plugin stopped working. Could it be related ?

    Thread Starter conradude

    (@hellodracon)

    Ok, I moved the object-cache.php file that was in wp-content/mu-plugins to wp-content and activated the plugin and now it seems to be working.

    • This reply was modified 1 month, 3 weeks ago by conradude.
    Thread Starter conradude

    (@hellodracon)

    Closing this thread as it’s fixed, I’ll open another for wpml.
    Thanks again

    Plugin Author Pierre Lannoy

    (@pierrelannoy)

    the object-cache.php file that was in wp-content/mu-plugins

    Ok, it explains all symptoms. This is strictly “forbidden” to have something that is not a mu-plugin inside this directory, because it is auto-loaded…

    Very happy you find the root-cause. ??

    Thread Starter conradude

    (@hellodracon)

    Yes, I think i never deleted it but just moved it into mu-plugins.. So sorry about everything.
    And thank you so much for your help and the plugins that are incredible really !

Viewing 14 replies - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.