Install APC (alternative PHP Cache) to improve PHP parsing speed
This article refers to "high-performance PHP development" to make the next record
PHP must perform the 5 steps required, whether from the command line or from a WEB server.
The Zend engine must read the file from the file system, scan its dictionaries and expressions, parse the file, create the computer code to be executed (called Opcode), and finally execute the Opcode.
PHP has a very short life cycle, but it must perform these 5 steps each time a request is initiated against the script. Each time a request arrives for a specific PHP script, the Zend engine must recreate the Opcode of the file, even if there is no change to the contents of the PHP script. The initial request for the script is necessary, but subsequent requests do not need to do so. If you implement the Opcode cache, you can omit three steps to shorten the life cycle of PHP
1) dictionary parsing;
2) analysis;
3) Create Opcode
APC can implement a Opcode cache of PHP scripts, but the APC cannot be turned on during development, or the script is modified, or the Zend engine executes the Opcode in the cache.
PECL APC Address: HTTP://PECL.PHP.NET/PACKAGE/APC
Install APC, take CentOS6.5 64-bit as an example
wget http://pecl.php.net/get/APC-3.1.9.tgz #下载tar zxvf apc-3.1.9.tgz #解压cd APC-3.1.9 #切换目录phpize #调出 Configure configuration file./configure--with-php-config=/usr/local/php/bin/php-config #配置make && make install #编译安装
Build apc.so after success
Open php.ini Add
Extension=apc.soapc.enabled=1apc.shm_segments=1apc.shm_size=128apc.stat=0apc.ttl=0
Save, restart Apache/nginx.
Attach APC Common settings parameters, everyone live to see it ~