• Resolved Razva

    (@razva)


    Hey,

    I’m getting this when trying to install your plugin:

    Fatal error: Cannot redeclare wp_cache_add() (previously declared in /home/plantemania/public_html/wp-includes/cache.php:41) in /home/plantemania/public_html/wp-content/plugins/object-cache.php on line 19

    Please note that I have manually uploaded object-cache.php to wp-content as recommended in the installation instructions.

    I’ve also added define( 'WP_CACHE_KEY_SALT', 'plantemania' ); in wp-config.php.

    Yes, the PHP module is installed and the service is running:

    plantemania@server:~$ php -m | grep memcache
    memcached
    
    plantemania@server:~$ systemctl status memcached
    ● memcached.service - memcached daemon
         Loaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset: enabled)
         Active: active (running) since Fri 2022-12-16 08:58:34 EET; 32min ago
           Docs: man:memcached(1)
       Main PID: 1473014 (memcached)
          Tasks: 10 (limit: 4694)
         Memory: 29.6M
            CPU: 1.599s
         CGroup: /system.slice/memcached.service
                 └─1473014 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid
    plantemania@server:~$

    Any way to fix this? Thank you

    • This topic was modified 3 years, 4 months ago by Razva.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Andrija Vučinić

    (@aidvu)

    Hey,

    plantemania@server:~$ php -m | grep memcache
    memcached

    So this isn’t the correct extension. It should return memcache not memcacheD.

    As for the fatal:

    Fatal error: Cannot redeclare wp_cache_add() (previously declared in /home/plantemania/public_html/wp-includes/cache.php:41) in /home/plantemania/public_html/wp-content/plugins/object-cache.php on line 19

    Did you by chance also install the plugin? If yes, uninstall and just copy object-cache.php to wp-content. No idea what the wp-content/plugins/object-cache.php file is (notice the /plugins).

    Thread Starter Razva

    (@razva)

    Hey,

    I appreciate the fast reply.

    As instructed I moved object-cache.php to from wp-content/plugins to wp-content. Here it is:

    $ ls ~/public_html/wp-content/
    index.php  languages  object-cache.php  plugins  smush-webp  themes  upgrade  uploads

    Here’s the content’s of the plugins folder:

    $ ls ~/public_html/wp-content/plugins/
    contact-form-7  google-site-kit  js_composer  meta-box            meta-box-tabs       redux-framework  sumodiscounts  wordpress-seo
    envato-market   index.php        mailpoet     meta-box-show-hide  nt-agro-shortcodes  revslider        woocommerce    wp-smushit

    The current result is wp-admin throwing There has been a critical error on this website.

    I have uploaded a simple PHP script to test if memcache is working and it’s fully functional (on the same page you can find a phpinfo that confirms that memcache 3.2.0 is installed and fully functional).

    Any hints on this?

    Thank you!

    Later edit: I can confirm that both W3 and LiteSpeedCache plugins can connect to the memcache server and enable the Object Cache function.

    • This reply was modified 3 years, 4 months ago by Razva.
    • This reply was modified 3 years, 4 months ago by Razva.
    Plugin Contributor Andrija Vučinić

    (@aidvu)

    The current result is wp-admin throwing There has been a critical error on this website.

    What does the PHP error log show for this now that you’ve moved the file?

    I have uploaded a simple PHP script to test if memcache is working and it’s fully functional (on the same page you can find a phpinfo that confirms that memcache 3.2.0 is installed and fully functional).

    This is what I’ve been trying to tell you. 🙂

    There are two PECL extensions for memcached backend:

    Hope that helps.

    Thread Starter Razva

    (@razva)

    Oh, ok, sorry for my stupidity! I’ve successfully installed memcache.

    For posterity, doing apt install phpX-memcached does not equal with apt install phpX-memcache.

    The Critical error is not being displayed after installing the correct PECL extension.

    Thank you for your patience and support!

    Plugin Contributor Andrija Vučinić

    (@aidvu)

    Oh, ok, sorry for my stupidity! I’ve successfully installed memcache.

    Don’t worry. 🙂 Glad it works now!

    Thank you for your patience and support!

    <3

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Fatal error: Cannot redeclare wp_cache_add()’ is closed to new replies.