5

I just installed Magento Commerce on my hosting account and am getting fairly sluggish performance. To help speed up the site, I installed the APC cache but am having trouble getting it to work. I used these install instructions.

I followed all the steps and seemed to get APC installed. No problems. When I check APC.php, it only shows 1 hit and 1 miss to the cache, which can't be right... Making me think APC isn't active or being used.

I tried to ensure Magento uses APC by adding the following to /var/www/app/etc/local.xml.

            <cache>
                    <backend>apc</backend>
                    <prefix>alphanumeric</prefix>
            </cache>

Any help is much appreciated.

4

3 回答 3

7

我建议您使用“字母数字”以外的唯一字符串。这样,如果您与其他用户或应用程序共享 APC,您的缓存就会有所不同。

您是否将 xml 节点放置在 local.xml 中的正确位置?上下文应该是这样的:

  ...
  <session_save><![CDATA[db]]></session_save>
  <cache>
    <backend>apc</backend>
    <prefix>ReplaceThisWithSomeUniqueString</prefix>
  </cache>
</global>

另外,请确保您rm -rf /var/www/var/cache/*在更改后执行了local.xml.

于 2011-04-20T00:47:25.597 回答
1

我遇到了同样的问题。就我而言,我以错误的方式设置了最大文件大小的参数。我没有M在值后面附加 a 。

所以我写了 apc.max_file_size=10 而不是 apc.max_file_size=10M。

于 2012-07-21T17:15:41.040 回答
1

检查您的服务器日志并查找分段违规。当您只看到 1 次命中/未命中时,这是一个确定的信号,表明每次命中都会杀死服务器进程。这是 PHP 和 APC 版本的某些组合的问题。

如果您使用 mmap 后端,请尝试在没有 mmap 的情况下再次编译 APC。(我经常在使用 mmap 后端时遇到崩溃。)

一个问题,你使用 PHP 5.2 还是 5.3?

于 2011-04-21T07:24:45.113 回答