APC (Alternative PHP Cache) diegimas CENTOS 6.x aplinkoje

APC (Alternate PHP Cache) – atvirojo kodo PHP kodo spartintuvas. APC tampa vis plačiau naudojamas ir yra stabilesnis už kitus spartintuvus (pvz.: eAccelerator). Ateityje planuojama, kad APC bus pagal nutylėjimą integruotas į PHP 6 branduolio versiją.

Prieš diegimą turime instaliuoti papildomus reikiamus paketus:

yum install php-pear php-devel httpd-devel pcre-devel gcc make


Įdiegus reikiamus komponentus, įdiegiame patį APC:

pecl install apc

Diegimo eigoje pateikiamas trumpas klausimynas, visur paliekame numatytas reikšmes:

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading APC-3.1.9.tgz ...
Starting to download APC-3.1.9.tgz (155,540 bytes)
.................................done: 155,540 bytes
54 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
config.m4:180: warning: AC_CACHE_VAL(PHP_APC_GCC_ATOMICS, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from...
config.m4:180: the top level
config.m4:180: warning: AC_CACHE_VAL(PHP_APC_GCC_ATOMICS, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from...
config.m4:180: the top level
Enable internal debugging in APC [no] :
Enable per request file info about files used from the APC cache [no] :
Enable spin locks (EXPERIMENTAL) [no] :
Enable memory protection (EXPERIMENTAL) [no] :
Enable pthread mutexes (default) [yes] :
Enable pthread read/write locks (EXPERIMENTAL) [no] :

APC cache bibliotekų užkrovimas:

echo "extension=apc.so" > /etc/php.d/apc.ini

Po užkrovimo, turite perkrauti APACHE servisą:

service httpd restart
OR
/etc/init.d/httpd restart

Kad patikrinti ar APC spartintuvas užkrautas galime patikrinti paprastai savo ‘vhoste’ sukūrus info.php failą su turinių:

< ?php
// Peržiūrim PHP konfigūraciją 
phpinfo(); 
?>

APC cache atnaujinimas:

pecl upgrade apc

APC cache pašalinimas:

pecl uninstall apc