应开发的要求,需要在服务器上为php安装apc模块
一、源代码安装:
wget http://pecl.php.net/get/APC-3.0.19.tgz
tar xzvf APC-3.0.19.tgz
cd APC-3.0.19
/usr/bin/phpize
./configure –enable-apc-mmap –enable-filehits –enable-apc
make
make install
二、yum 安装方法
yum install php-devel php-pear httpd-devel
pecl install apc
一路回车即可,最后会自动在/usr/lib64/php/modules下生成apc.so模块,配置php.ini加载即可。
如果有以下错误:
In file included from /usr/local/src/APC-3.1.5/apc.c:38:
/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /usr/local/src/APC-3.1.5/apc.c:38:
… …
/usr/local/src/APC-3.1.5/apc.c: In function ‘apc_regex_compile_array’:
/usr/local/src/APC-3.1.5/apc.c:419: error: ‘apc_regex’ has no member named ‘preg’
/usr/local/src/APC-3.1.5/apc.c:419: error: ‘apc_regex’ has no member named ‘preg’
/usr/local/src/APC-3.1.5/apc.c:420: error: ‘apc_regex’ has no member named ‘nreg’
/usr/local/src/APC-3.1.5/apc.c:420: error: ‘apc_regex’ has no member named ‘nreg’
/usr/local/src/APC-3.1.5/apc.c: In function ‘apc_regex_match_array’:
/usr/local/src/APC-3.1.5/apc.c:452: error: ‘apc_regex’ has no member named ‘preg’
/usr/local/src/APC-3.1.5/apc.c:452: error: ‘apc_regex’ has no member named ‘preg’
/usr/local/src/APC-3.1.5/apc.c:453: error: ‘apc_regex’ has no member named ‘nreg’
/usr/local/src/APC-3.1.5/apc.c:453: error: ‘apc_regex’ has no member named ‘nreg’
make: *** [apc.lo] Error 1
安装 pcre-devel就可以解决
yum install pcre-devel
G来的一些配置:
extension = apc.so
apc.enabled = 1
apc.optimization = 0
apc.shm_segments = 1
apc.shm_size = 56
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 10000
apc.user_entries_hint = 10000
apc.mmap_file_mask = /tmp/apc.XXXXXX
apc.enable_cli = 1
apc.cache_by_default = 1
apc.max_file_size = 5
apc.stat = 1
专注于 服务器运维与web架构
E-mail:venus#rootop.org