This is because it is called "Optional PHP cache", which is easy to give you the illusion that it is not useful.
APC homepage: http://pecl.php.net/package/apc. The current version is 3.0.14, installed through PECL, requires php4.3.0 or later.
Php apc installation:
Download the source code and then use phpize to compile and install it. After installation, add the php. ini file.
Extension = apc. so
This line is enough.
Php apc usage:
The Application of APC is actually not mentioned. APC is an optimizer. since its installation, it has quietly served your PHP application in the background. all your PHP code will be cached. in addition, APC can provide certain memory cache functions. however, this function is not perfect. It is reported that frequent use of the write function of APC cache will lead to unexpected errors. if you want to use this function, you can look at several functions related to apc cache, such as apc_fetch and apc_store. beginning with PHP5.2, APC introduced a small cookie, which solved the long-standing progress bar problem of uploading large files.
Advanced use of PHP APC
1. cache Duration: APC cache is divided into two parts: system cache and user data cache.
The system cache is automatically used. It means that APC caches the compilation result of the PHP file source code and compares the time mark when calling the PHP file again. If it has not expired, use the cache code to run it. The default cache is 3600 s (one hour ). however, this will still waste a lot of CPU time. therefore, you can. set system cache in ini to never expire (apc. ttl = 0 ). however, after the php code is modified, You need to restart your web server (such as apache ...). Currently, the performance test of APC generally refers to this layer of cache;
The user data cache is read and written by the user using the apc_store and apc_fetch functions when writing php code. if the quantity is small, I suggest you use it. we recommend that you use memcache if the size is large. to enjoy the cached upload progress of large files brought by APC, you must go to php. set apc in ini. rfc1867 is set to 1, and a hidden domain APC_UPLOAD_PROGRESS is added to the form. The value of this field can generate a random hash, so it is unique. for more information, see the previous link.
2. status control and analysis: the php apc source package comes with an apc. php. You can upload the file to a directory on the web server and access it in a browser. This displays the current status. we can analyze the current cache status from the table here and make further optimization. apc-info-clublocalhost2.png is the status of a test site. you can analyze it slowly. This tool provides many useful tools. for example, you can see which files are frequently included (accessed), which variables you cache are frequently read, or updated. finally, by the way, an independent report said that the code cache and optimization effect of php apc should be higher than that of the zend optimizer. even if it is not true, he is open-source and free, it is a very good choice.