昨天在Linux项目中试用了APC,初步测试下性能提高了125%之多
下载地址:
下了最新的3.0.16-stable,解压,进入目录
/usr/local/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/local/bin/php-config
make
make install
cp /usr/local/lib/php/extensions/no-debug-zts-20060613/apc.so /usr/local/lib/php/extensions/apc.so
chmod 755 /usr/local/lib/php/extensions/apc.so
配置/etc/php.ini 末尾加入
extension=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
重启apache
从apc.php看到结果,hits rate高达98%以上,令人满意。