1.首先安装php-apc
sudo apt-get install php-pear php5-dev apache2-threaded-dev
sudo pecl install apc-3.1.7
2.再在magento /app/etc/local.xml中
<config>
<global>
<install>
<date><![CDATA[Thu, 12 May 2011 05:06:06 +0000]]></date>
</install>
<crypt>
<key><![CDATA[295888775466d0eb721707c95763b0be]]></key>
</crypt>
<disable_local_modules>false</disable_local_modules>
<resources>
<db>
<table_prefix><![CDATA[]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[123456789]]></password>
<dbname><![CDATA[shop]]></dbname>
<active>1</active>
</connection>
</default_setup>
</resources>
<session_save><![CDATA[files]]></session_save>
<cache>
<backend>apc</backend>
<prefix>MAGE_</prefix>
</cache>
</global>
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[thisisadmin]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
</config>
增加红色部分
3.在magento后台清空缓存
4.打开php.ini文件
添加
extension=apc.so
apc.shm_size = 256
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=5M
参数参考信息(https://blog.nexcess.net/2011/03/25/optimizing-apc-cache-settings-for-magento/)
5.重启php,在/usr/share/doc/php-apc/下找到apc.php.gz,解压此文件,得到apc.php
(不同系统文件路径不同,我所用的是ubuntu12.04)
6.将文件放到项目根目录下访问,即可看到phpapc相关信息
7.设置php-apc登陆密码
打开apc.php,找到
defaults('ADMIN_USERNAME','apc'); // Admin Username
defaults('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!!
修改密码后,点击右上角login,即可登录查看信息