下载http://pecl.php.net/package/APC 找最新的


#wget http://pecl.php.net/get/APC-3.1.9.tgz

# tar -zxvf APC-3.1.9.tgz
# cd APC-3.1.9
# /usr/local/php/bin/phpize (生产configure文件)
# ./configure –enable-apc –enable-apc-mmap –with-php-config=/usr/local/php/bin/php-config
# make
# make install

拷贝添加SO文件
# cp /usr/local/lib/php/extensions/no-debug-zts-20060613/apc.so /usr/local/php/lib/php/extensions/apc.so
# chmod 755 /usr/local/php/lib/php/extensions/apc.so
修改PHP.INI使之启动APC模块
修改 php.ini下
extension_dir = “./”
extension_dir = “/usr/local/php/lib/php/extensions”
配置/etc/php.ini 末尾加入
extension=apc.so
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 128M
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 1024
apc.write_lock = On
apc.gc_ttl=3600
apc.ttl=0
;apc.mmap_file_mask=/tmp/apc.XXXXXX
重启php-fpm



使用APC

<?php

print_r(apc_cache_info());

?>

多次点击,可以发现num_hits在变化,说明缓存命中了!