PHP APC 安裝
3.1.9 最新穩定版
wget http://pecl.php.net/get/APC
tar -zxf APC-3.0.16.tgz
cd APC-3.0.16
(phpize
(如果phpize出現錯誤表示沒有裝 php-devel, 直接 yum install php-devel)
whereis php-config
得出類似結果 php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
)
自編安裝LAMP
/usr/local/php5/bin/phpize
(
./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/bin/php-config
)
自編安裝LAMP
./configure –enable-apc –enable-apc-mmap -with-apxs=/usr/local/apache/bin/apxs –with-php-config=/usr/local/php5/bin/php-config
make
(如果出現 ‘apc_regex’ has no member named ‘preg’ 表示沒安裝 pcre-devel, 直接 yum install pcre-devel)
make install
Installing shared extensions: /usr/lib64/php/modules/
重新啟動Apache
修改 php.ini
extension=apc.so
apc.enabled=1 # default = 1
apc.shm_segments=1 # default = 1
apc.shm_size=128M # default = 30
apc.ttl=7200 # default = 0
apc.user_ttl=7200 # default = 0
apc.num_files_hint=1024 # default = 1000
apc.mmap_file_mask=/tmp/apc.XXXXXX # default = no value
apc.enable_cli=1 # default = 0
相關參數我們再研究~
存檔
再次Restart Apache
OK
[除錯]
錯誤:PHP Fatal error: Cannot redeclare class
解決:apc.cache_by_default = 0