- 安装php-apc
wget http://pecl.php.net/get/APC-3.1.8.tgz
tar xzvf APC-3.0.18.tgz
/usr/local/webserver/php/bin/phpize
./configure --enable-apc --enable-mmap --enable-apc-spinlocks --disable-apc-pthreadmutex --with-php-config=/usr/local/webserver/php/bin/php-config
make && make install
- php.ini配置
[apc]
extension = apc.so
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 160M
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 0
apc.write_lock = On
apc.gc_ttl=3600
apc.ttl=0
- 配置成功
重启nginx 和 php-fpm,打开phpinfo查看如下图所示,证明配置成功: