当前我用的是APC-3.1.9 stable ,可以自己到 http://pecl.php.net/package/APC 下载最新版。
1、安装
wget http://pecl.php.net/get/APC-3.1.9.tgz
tar xzvf APC-3.1.9.tgz
cd APC-3.1.9
/usr/local/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/local/php/bin/php-config --prefix=/usr/local/apc
make && make install
注:安装编译后检查相应目录:
ll /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
-rwxr-xr-x 1 root root 659164 Apr 8 18:30 apc.so
安装成功!
2、配置/usr/local/php/etc/php.ini
vi /usr/local/php/etc/php.ini
shift+g到最末行,末尾加入
[apc]
extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/apc.so"
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 64
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 0
apc.write_lock = On
然后把APC目录下的apc.php复制到可以访问的目录
cp /root/APC-3.1.9/apc.php /home/wwwroot/
3、重启 LNMPA
/root/lnmpa restart
4、附:Windows下安装apc方法
下载地址: http://kromann.info/php5_2-Release_TS/php_apc.dll
extension = php_apc.dll