WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Bug: Disk-enhanced caching on Nginx fails, due to a typo in the nginx.conf file (11 posts)

  1. Pothi
    Member
    Posted 1 year ago #

    W3 Total Cache version: 0.9.2.8
    WordPress version: 3.5.1
    Other plugins activated: none

    To reproduce what I meant in the subject header...

    - Deactivate all the modules in W3TC.
    - Activate disk-enhanced caching
    - Restart nginx
    - Visit the home page as a non-logged-in user.

    What is expected: The home page with '200' as the header.
    What is occurring: The home page produces '404'

    What has gone wrong: A typo in the default configuration.

    A rewrite rule in the default configuration looks like this at the moment...

    if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index.html") {
      set $w3tc_rewrite 0;
    }

    However, it should be...

    if (!-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index.html") {
      set $w3tc_rewrite 0;
    }

    This is due the missing '!' symbol at line number 923 of 'lib/W3/Plugin/PgCacheAdmin.php' file.

    I hope this helps someone who has had the same issue with the version 0.9.2.8 of W3TC.

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

  2. Eco Green Days
    Member
    Posted 1 year ago #

    I have same issue: i tried this code modification and not work! My WordPress is now broken, and is impossible to access on my dashboard!

  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    @Eco Green Days

    please start your own topic.

    http://codex.wordpress.org/Forum_Welcome#Where_To_Post

  4. Keating
    Member
    Posted 1 year ago #

    Is this for 0.9.2.8 only, not previous versions?

  5. Pothi
    Member
    Posted 1 year ago #

    Keating

    I wish I had time to look into the previous versions as well. However, I'm sure that 0.9.2.5 worked correctly on an Nginx server in disk-enhanced mode. I only tested the latest version at the time of testing, submitted a bug report, and then posted the solution here for the benefit of others who may need to wait until it is fixed.

  6. Frederick Townes
    Member
    Plugin Author

    Posted 1 year ago #

    Fixed in the next release.

  7. tarkin79
    Member
    Posted 1 year ago #

    Still not fixed in the latest release. Pothi's fix above has to be re-applied after upgrade.

  8. Max
    Member
    Posted 1 year ago #

    Yup, not fixed in 0.9.2.9.

    uDiff of the fix, for those who want to repair this themselves.:

    --- PgCacheAdmin.php.old	2013-04-17 18:31:56.161238452 +0000
    +++ PgCacheAdmin.php	2013-04-17 18:32:30.065576141 +0000
    @@ -920,7 +920,7 @@
             if (!$this->_config->get_boolean('pgcache.cache.nginx_handle_xml')) {
                 $env_w3tc_ext = '.html';
    
    -            $rules .= "if (-f \"\$document_root" . $uri_prefix . ".html" .
    +            $rules .= "if (!-f \"\$document_root" . $uri_prefix . ".html" .
                     $env_w3tc_enc . "\") {\n";
                 $rules .= "  set \$w3tc_rewrite 0;\n";
                 $rules .= "}\n";

    Once you have applied the fix, you need to save the options in Page Cache in W3 Total Cache, then restart nginx, to reload the file that is generated.

  9. Vince
    Member
    Posted 1 year ago #

    I can confirm that it has not been fixed in 0.9.2.9

  10. adamsadowski
    Member
    Posted 1 year ago #

    I think it is fixed in 0.9.2.10

    lib/W3/Plugin/PgCacheAdmin.php is still there, but doesn't have that code anymore.

    I believe it is in lib/W3/PgCacheAdminEnvironment.php on line 1002, and it looks like it is fixed.

  11. Pothi
    Member
    Posted 1 year ago #

    Yes, I do think it's fixed. I didn't look at the code, though, since it's been fixed.

    Thanks for the note @adamsadowski .

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic