1. APC
Alternative PHP cache (APC) is an effective open-source high-speed buffer storage tool for PHP. It can cache the opcode's PHP intermediate code.
Php apc provides two caching functions: cache opcode (target file), which is called apc_compiler_cache. It also provides some interfaces for PHP developers to resident user data in the memory, which is called apc_user_cache. Here we mainly discuss the configuration of PHP-APC.
(1) Installation
CD/usr/local/PHP/bin
./PECL install APC
(2) download PHP. ini from/usr/local/PHP/lib and add extension = APC. So
(3) Restart PHP,/usr/local/PHP/sbin/PHP-FPM.
2. eaccelerator
Accelerator is a free and open source PHP accelerator. It optimizes and dynamically caches content, improves the cache performance of PHP scripts, and enables PHP scripts to be compiled, the server overhead is almost completely eliminated. It also optimizes scripts to accelerate execution efficiency. Improve the code execution efficiency of your PHP program by 1-10 times;
(1) download http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip/download
(2)
After decompression, CD/home/admin/eaccelerator-0.9.6.1
(3) Compile
export PHP_PREFIX="/usr/local/php"$PHP_PREFIX/bin/phpize./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-configmake
(4) Installation
make install
(5) Configuration
If Zend is installed, the configuration is as follows:
zend_extension="/usr/lib/php4/eaccelerator.so"eaccelerator.shm_size="16"eaccelerator.cache_dir="/tmp/eaccelerator"eaccelerator.enable="1"eaccelerator.optimizer="1"eaccelerator.check_mtime="1"eaccelerator.debug="0"eaccelerator.filter=""eaccelerator.shm_max="0"eaccelerator.shm_ttl="0"eaccelerator.shm_prune_period="0"eaccelerator.shm_only="0"eaccelerator.compress="1"eaccelerator.compress_level="9"
The common configuration is as follows:
extension="eaccelerator.so"eaccelerator.shm_size="16"eaccelerator.cache_dir="/tmp/eaccelerator"eaccelerator.enable="1"eaccelerator.optimizer="1"eaccelerator.check_mtime="1"eaccelerator.debug="0"eaccelerator.filter=""eaccelerator.shm_max="0"eaccelerator.shm_ttl="0"eaccelerator.shm_prune_period="0"eaccelerator.shm_only="0"eaccelerator.compress="1"eaccelerator.compress_level="9"
(6) create a cache folder
mkdir /tmp/eacceleratorchmod 0777 /tmp/eaccelerator
Reference URL:
Http://cn.php.net/manual/en/apc.installation.php
Http://eaccelerator.net/wiki/InstallFromSource