先例行介绍一下:

WP Super Cache是一款WordPress静态化插件,与很多人使用的WP-Cache相似,都是通过缓存提高WordPress的性能,WP Super Cache 相比 WP-Cache 最大的改进,在于加入了 Super Cache 这一环节。部分页面会根据一定的规则被缓存为SuperCache,而这个 SuperCache 实质上就是页面本身。通过 Apache mod_rewrite 重定向直接访问这些静态文件,理论上可以获得更好的性能。

在我这里出现的问题就是安装一切正常,但就是没有cache文件产生,页面下面也没有CACHE by XXX的提示,权限都改成777也不行。尝试了很多方法,包括重装插件,修改content权限,甚至换用Hyper cache也没有效果,同样安装正常但不缓存。cos-html-cache倒是有效果,可惜个人小站全静态好像也用不上。

解决方法,前几天重新又装了遍super cache插件,把里面的英文说明文件仔细看了一遍,才发现有这么一个问题:

= Troubleshooting =

If things don't work when you installed the plugin here are a few things to check:

1. Is wp-content writable by the web server?
2. Is there a wp-content/wp-cache-config.php ? If not, copy the file wp-super-cache/wp-cache-config-sample.php to wp-content/wp-cache-config.php and make sure WPCACHEHOME points at the right place. "plugins" should be "mu-plugins" if you're using WordPress MU.
3. Is there a wp-content/advanced-cache.php ? If not, then you must copy wp-super-cache/advanced-cache.php into wp-content/. You must edit the file and change the path so it points at the wp-super-cache folder.
4. If pages are not cached at all, remove wp-content/advanced-cache.php and recreate it, following the advice above.
5. Make sure the following line is in wp-config.php and it is ABOVE the "require_once(ABSPATH.'wp-settings.php');" line:

`define( 'WP_CACHE', true );`
6. Try the Settings->WP Super Cache page again and enable cache.
7. Look in wp-content/cache/supercache/. Are there directories and files there?
8. Anything in your php error_log?
9. If your browser keeps asking you to save the file after the super cache is installed you must disable Super Cache compression. Go to the Settings->WP Super Cache page and disable it there.

注意蓝色部分,安装中一步需要编辑wp-settings.php应该是wp-config.php配置文件,加入

define( 'WP_CACHE', true );

这一句,而且代码必须在

require_once(ABSPATH.'wp-settings.php');

这一段的上面。以前加入时我都放在了最后,关键是网上给的教程都没有提及这一点,而缓存不成功的原因google了很久也没有找到,这么一个小问题浪费了许多时间。

目前还有一个关于php生成文件/文件夹 权限的问题,由于是Apache产生的,我这里owner显示的是99,而不是我的ID,那么我就无法删除这个以及修改权限,还不知道怎么办?
以前曾联系虚拟主机机房管理员删除了一个,现在又留下一堆(hyper cache遗留产品),也不能每次都麻烦人家...

PS:今天又宅了一天,复习计划又拖延...
唉,这样下去可不好,老毛病一时半会儿改不了
果然白羊座只有三分钟激情么?

  1. 严重浪漫 (2010.10.05 at 14:32) ☆沙发

    很好的经验,记下了

  2. 清风无影 (2010.10.20 at 23:35) 板凳

    安装中一步需要编辑wp-settings.php配置文件,加入

    应该是编辑wp-config.php

    • winy() (2010.10.20 at 23:44)

      @清风无影 ,是的,原文翻译的,倒真没注意,我确实是改的wp-config.php,应该是老版本

发布评论

邮箱(必填)

换个背景