WordPress.org

Ready to get started?Download WordPress

Forums

Memcached Object Cache
Double Function Declaration (5 posts)

  1. syslogic
    Member
    Posted 1 year ago #

    One activation it tells me: Fatal error: Cannot redeclare wp_cache_add() (previously declared in /var/www/wp-includes/cache.php:24) in /var/www/wp-content/plugins/memcached/object-cache.php on line 22

    http://wordpress.org/extend/plugins/memcached/

  2. Matt Martz
    Member
    Plugin Author

    Posted 1 year ago #

    The problem is that the memcached object cache plugin is not a standard plugin. It is what is called a "Drop-In". As such the object-cache.php file should not be located at /var/www/wp-content/plugins/memcached/object-cache.php, it should be moved to /var/www/wp-content/object-cache.php

    What is happening is that WP will look to see if wp-content/object-cache.php exists and if it does, it will use that as opposed to wp-includes/cache.php. Since you have it in the wrong location, it is including both, causing the fatal error because of a redeclared function.

  3. syslogic
    Member
    Posted 1 year ago #

    How about ...

    if(!function_exists('wp_cache_add')){
    /* assuming a proper file location */
    }
    else {
    /* notice the user to move the file */
    }

    Like this activation won't bug out while the user knows why it's not working.

  4. syslogic
    Member
    Posted 1 year ago #

    If the plugin would have one more file, this one could be used for moving the drop-in a level upward; not much functionality contained - just a simple installer plug-in package which installs the drop-in.

  5. Matt Martz
    Member
    Plugin Author

    Posted 1 year ago #

    That has actually been on my todo list for a while. I actually plan on using the same method as the APC object cache plugin:

    http://plugins.trac.wordpress.org/browser/apc/trunk/object-cache.php#L23

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.