Compared with other compiled languages, the performance of PHP is not outstanding, but the performance improvement is obvious after the OPCode cache is used. common examples include Eaccelerator, XCache, and APC. this document mainly introduces the use of APC.
APC introduction
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.
APC official website: http://www.php.net/manual/en/book.apc.php
Windows under the latest version of: http://downloads.php.net/pierre/
Download link: The http://downloads.php.net/pierre/php_apc-3.1.4-5.3-VC6-x86.zip uses the corresponding DLL based on your PHP build
APC configuration
APC configuration mainly describes the configuration in Windows. There are many articles on configuration in linux.
1. download php_apc.dll to the PHP ext directory.
2. modify php. ini to add extension = php_apc.dll
Add configuration items at the end of php. ini
; APC Setting
[APC]
; An error will be reported when stat is enabled.
; Apc. stat = 0
Apc. enabled = "1 ″
Apc. shm_segments = "1 ″
The problem here is that the default memory configuration for Windows 7 is changed. do you know if you have any problems?
; Apc. shm_size = "128 ″
; Apc. ttl = 7200
; Apc. user_ttl = 7200
; Corrected metric data
Apc. ttl = "300 ″
Apc. user_ttl = "300 ″
Apc. num_files_hint = "1024 ″
Apc. mmap_file_mask = "E:/Wamp/tmp/apc. XXXXXX"
Apc. enable_cli = "1 ″
3. restart the apache server and check whether the apc configuration item exists in phpinfo. If yes, the configuration is successful.
APC control panel, control files from APC-3.1.4.tgz
Before cache is used
After cache is used
FAQs:
1. what is the Cache clearing problem for OPCode under fcgi?