En ubuntu y otras distribuciones de Linux es posible instalar APC para php simplemente haciendo apt-get install php-pecl-apc. Sin embargo en CentOS 7 no existe el paquete, así que instalaremos a mano, siguiendo las instrucciones del siguiente artículo:
$ yum install php-pear php-devel httpd-devel pcre-devel gcc make
$ pecl install apc
Después creamos el archivo /etc/php.d/apc.ini y le vamos añadiendo los siguientes valores:
Enable APC for php.
extension=apc.so
apc.enabled=1
The number of seconds a cache entry is allowed to idle in a slot before APC dumps the cache.
apc.ttl=72000
apc.user_ttl=72000
apc.gc_ttl=3600
Size of memory for apc ( 1024 M)
apc.shm_size=1024M
Enable apc stats.
apc.stat=1
Enable APC for command line php operations.
apc.enable_cli=1
Allow 2 seconds after a file is created before it is cached. This will prevent premature PHP pages to get cached.
apc.file_update_protection=2
Maximum size of single file that apc can store.
apc.max_file_size=1M
Maximum number of files APC can store ( rotation).
apc.num_files_hint=200000
Maximum number of users data entries that APC can store.
apc.user_entries_hint=20000
You can put your configuration in php.ini file but i prefer to have separate file like above for configuration. Values mentioned above are for demonstration purpose, different values for APC can be set which depends on number of PHP pages, size of memory in server, number of page hits e.t.c
Reiniciamos apache y ya está:
service httpd restart
La salida de phpinfo() muestra la siguiente configuración de APC: