Brief introduction:
Alternative PHP cache (APC) is an open and free php opcode cache. Its goal is to provide a free, open and robust framework for caching and optimizing PHP's intermediate code to speed up PHP execution.
Common PHP accelerators are eaccelerator, XCache, and so on.
: http://pecl.php.net/get/APC-3.1.9.tgz
1. Installing APC
Shell >wgethttp//pecl.php.net/get/apc-3.1.9.tgzShell>TarZXF apc-3.1.9. tgz-c. /Shell> CD. /apc-3.1.9/Shell>/usr/local/php/bin/Phpizeshell>./Configure--with-php-config=/usr/local/php/bin/php-Config--enable-APC--enable-apc-mmap--enable-apc-spinlocks--disable-apc-Pthreadmutexshell> Make; Make Install
2, Configuration PHP.ini
Shell >CP/usr/local/php/lib/php/extensions/no-debug-zts-20100525/apc.so/usr/lib64/Shell> vim/usr/local/php/Php.iniextension_dir=/usr/lib64/extension=apc.so[apc]apc.enabled=1# enable APCAPC.Stat=1# Checks whether the script is updated every time the script is executed apc.shm_segments=1# Number of shared memory Apc.shm_size=30M # Shared memory size, adjustable according to actual memory apc.optimization=0Apc.num_files_hint=0Apc.ttl=7200# Cache-to-image lifecycle, in seconds Apc.user_ttl=7200# User Cache pair like life cycle Apc.gc_ttl=3600Apc.cache_by_default= on # Enable caching for all files
# # for parameters please refer to the official website: http://php.net/manual/zh/apc.configuration.php
3. Testing
grep APCAPC
# # Description has been loaded successfully, can restart the Web view phpinfo page
# # Restart PHP-FPM error, can start, but will error
Shell > Service php-fpm restartgracefully shutting down PHP-FPM. DoneStarting PHP-fpm/etc/init.d/php-fpm:line -:8323Segmentation fault $php _fpm_bin--daemonize $php _opts Failedshell>Tail/usr/local/php/var/log/php-fpm.log[ --jan- - the: +: -] NOTICE:FPM is running, PID8325[ --jan- - the: +: -] Notice:ready to handle Connectionsshell> NETSTAT-ANPT |grepphp-fpmtcp0 0 127.0.0.1:9000 0.0.0.0:* LISTEN8325/php-fpm
# # reason unknown, replace this version with the following version
: http://pecl.php.net/get/APC-3.1.13.tgz
# # Installation method as above, apc.so directly replace can, restart no error
Alternative PHP Cache (APC)