如何强制 Magento 使用 APC 缓存
我刚刚在我的托管帐户上安装了 Magento Commerce,但性能相当缓慢。为了帮助加快网站速度,我安装了 APC 缓存,但无法使其正常工作。我使用了这些安装说明。
我遵循所有步骤,似乎已经安装了 APC。没问题。当我检查 APC.php 时,它只显示缓存有 1 次命中和 1 次未命中,这不可能是正确的...让我认为 APC 未激活或未被使用。
我尝试通过将以下内容添加到 /var/www/app/etc/local.xml 来确保 Magento 使用 APC。
<cache>
<backend>apc</backend>
<prefix>alphanumeric</prefix>
</cache>
非常感谢任何帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议您使用“字母数字”以外的唯一字符串。这样,如果您与其他用户或应用程序共享 APC,您的缓存将会有所不同。
您是否将 xml 节点放置在 local.xml 中的正确位置?上下文应该是这样的:
另外,请确保在更改
local.xml
后执行了rm -rf /var/www/var/cache/*
。I suggest that you use a unique string other than "alphanumeric". That way if you are sharing APC with other users or applications, your cache will be differentiated.
Have you placed the xml nodes in the correct location in local.xml? The context should be like this:
Also, make sure that you did a
rm -rf /var/www/var/cache/*
after changinglocal.xml
.检查您的服务器日志并查找分段违规情况。当您只看到 1 次命中/未命中时,则表明每次命中都会终止服务器进程。这是 PHP 和 APC 版本的某些组合的问题。
如果您使用 mmap 后端,请尝试在不使用 mmap 的情况下再次编译 APC。 (我经常在使用 mmap 后端时遇到崩溃。)
一个问题,您使用 PHP 5.2 还是 5.3?
Check your server logs and look for segmentation violations. When you ever only see 1 hit/miss, it's a sure sign that each hit kills the server process. This is a problem with certain combinations of PHP and APC versions.
If you're using the mmap backend, try compiling APC again without mmap. (I often experienced crashes using the mmap backend.)
A question, do you use PHP 5.2 or 5.3?
我遇到了同样的问题。就我而言,我以错误的方式设置了最大文件大小的参数。我没有在值后面附加
M
。因此,我写了 apc.max_file_size=10,而不是 apc.max_file_size=10M。
I ran into the same issue. In my case I set the parameter for the max file size in the wrong way. I didn't append a
M
behind the value.So instead of apc.max_file_size=10M I wrote apc.max_file_size=10.