Alternative PHP Cache(APC)是PHP opcode 缓存,目标是提供缓存和优化PHP的中间代码。
1、编译Alternative PHP Cache(APC)。
cd /usr/local/directadmin/custombuild wget http://pecl.php.net/get/APC-3.1.13.tgz tar xvzf APC-3.1.13.tgz cd APC-3.1.13 /usr/local/php53/bin/phpize53 ./configure --with-php-config=/usr/local/php53/bin/php-config53 make make install
2、修改php.ini文件,加载APC组件。
[Alternative PHP Cache] extension = "apc.so" ; ; APC setting apc.enabled = 1 apc.shm_segments = 1 apc.shm_size = 64M apc.optimization = 1 apc.num_files_hint = 0 apc.ttl = 0 apc.gc_ttl = 3600 apc.cache_by_default = on
[Alternative PHP Cache] extension_dir = "/usr/local/php53/lib/php/extensions/no-debug-non-zts-20090626/" extension=apc.so apc.enabled=1
DirectAdmin中php.ini的文件位置:
/usr/local/lib/php.ini # 默认的PHP版本。 /usr/local/etc/php5/cgi/php.ini # 以CGI模式(SuPhp)运行PHP5。 /usr/local/php53/lib/php.ini # 新版。
3、重启Apache
service httpd restart