WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
WT3C shows random pages in multisite installation (7 posts)

  1. Farlif
    Member
    Posted 1 year ago #

    Hello,

    I love WT3C! It brought two of my websites from over 5 seconds to about 2 seconds and from over 3 seconds to 1,2 seconds. That's just great.
    But, unfortunately I've got a multisite installment, containing website A, website B and so on ... and now WT3C delivers random homepages in different browser windows - so that if I type in the URL of site A, in Chrome I get site B, in Firefox site C, in Safari I get the right site A, but in Opera site D ... Kind of strange :)
    I don't know how to fix this ... Maybe it would help if I knew, where in the code WT3C does fetch the different pages from? Or - is there another workaround to get it right?

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. laurionb
    Member
    Posted 1 year ago #

    I had a similar issue when I put multiple WordPress installations on the same server (not multisite -- just multiple installations on the same server). The problem was that the APC/memcached cache was shared between the installations so they would retrieve each other's cached objects. I'm wondering if something like that could be affecting you.

    I fixed the problem by modifying the code to make the cache key unique:

    http://technology.bernews.com/w3tc-caching-and-multiple-wordpress-installations/

  3. Farlif
    Member
    Posted 1 year ago #

    Thank you laurinb,

    for I am not a php programmer I have to follow your guidance step by step like a virtual sheep ... better I ask back, before I crash everything here ...

    In w3-total-cache/wp-content/db.php I write it that way, right?:

    if (!@is_dir(W3TC_DIR) || !file_exists(W3TC_DIR . '/inc/define.php')) {
        if (!defined('WP_ADMIN')) { // lets don't show error on front end
            require_once (ABSPATH . WPINC . '/wp-db.php');
        } else {
            @header('HTTP/1.1 503 Service Unavailable');
            die(sprintf('<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.', __FILE__));
    $key = md5(__FILE__) . '_' . $key;
        }
    } else {
        require_once W3TC_DIR . '/inc/define.php';
    
        $config = & w3_instance('W3_Config');
        if ($config->get_boolean('dbcache.enabled')) {
            if (defined('DB_TYPE')) {
                $db_driver_path = sprintf('%s/Db/%s.php', W3TC_LIB_W3_DIR, DB_TYPE);
    $key = md5(__FILE__) . '_' . $key;
    
                if (file_exists($db_driver_path)) {
                    require_once $db_driver_path;
                } else {
                    die(sprintf('<strong>W3 Total Cache Error:</strong> database driver doesn\'t exist: %s.', $db_driver_path));
    $key = md5(__FILE__) . '_' . $key;
                }
            }

    Thanks again!

  4. laurionb
    Member
    Posted 1 year ago #

    That isn't the right place to make the change.

    First I want to make sure this might help. A few questions:
    - Do you have a wordpress multisite installation, or did you just install multiple wordpress blogs on the same machine?
    - What type of caching are you using (memcached, APC, disk, disk enhanced)?

  5. Farlif
    Member
    Posted 1 year ago #

    Thanks for coming back, larionb.

    I have a single database with a multidomain wordpress installation and several blogs running on it. A friend of mine set it up for me by adding some lines to the config.php, I couldn't have done it. It's a hack by Richard Martin:
    $table_prefix = ereg_replace(‘^(www\.)’, ”, $_SERVER['HTTP_HOST']); $table_prefix = ereg_replace(‘\.’, ”, $table_prefix); $table_prefix = ereg_replace(‘\-’,”, $table_prefix); $table_prefix = $table_prefix . ‘_’;
    It works very fine, e.g. if I install a plugin on one of the websites, the other sites have got it too, it just has to be activated there. The only issue I had until today was creating the xml-sitemap by the Google XML Sitemap plugin (every single blog tried to create a "sitemap.xml" in the same root directory, and I had to rename them to sitemapblog1.xml, sitemapblog2.xml ..., so that each blog has it's own one now). The two problems seem to me as if they are somehow related ... Maybe WT3C tries to find and use the sitemap, so that's a possible source of error too.

    My hoster doesn't allow me to use APC or memcache, so it's just disk.

    Does anything of this help?

  6. laurionb
    Member
    Posted 1 year ago #

    It looks like you have just one WordPress installation, but with multiple blogs. The way that W3TC works it can't differentiate between the different cached pages for those blogs. The hack that I linked to won't work because it relies on having different wordpress installations.

  7. Farlif
    Member
    Posted 1 year ago #

    Ok, but thanks for trying, laurionb!
    Maybe anyone else knows how to deal with the problem?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic