Because this thing is called "Optional PHP cache", it is easy to give a kind of can not, not useful illusion.
The APC homepage is: HTTP://PECL.PHP.NET/PACKAGE/APC. The current version is 3.0.14, which is installed through pecl and requires php4.3.0 or later versions.
Installation of the PHP APC:
Generally download the source code and then phpize to compile the installation, after installation in addition to php.ini add
Extension=apc.so
This is the line.
Use of the PHP APC:
The use of APC is not a real thing. APC is an optimizer that silently serves your PHP application in the background from the date of installation. All your PHP code will be cached. In addition, APC provides a certain amount of memory caching. However, this feature is not perfect, and there are reports of unpredictable errors that can occur if the use of the APC cache write function is frequent. If you want to use this feature, look at the APC_FETCH,APC_ Store and several other functions related to APC cache. Starting with the PHP5.2, APC introduced a cookie to solve the problem of the progress bar of uploading large files that have plagued you for a long time.
Advanced use of PHP APC
1. Cache Duration: APC caches are divided into two parts: the system cache and the user data cache.
The system cache is automatically used, which means that APC caches the compiled results of the PHP file source code, and then compares the timestamp with the time tag when it is called again. If it does not expire, it is run with cached code. The default cache is 3600s (one hour). But that still wastes a lot of CPU time. Therefore, you can set the system cache to never expire (apc.ttl=0) in php.ini. However, if you do this, you need to restart your Web server after changing the PHP code ( such as Apache ...). The current performance test for APC is generally referred to as 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 amount is not small, I suggest you can use it. If the volume is large, I recommend that you use memcache better. If you want to enjoy the characteristics of the upload progress of large cache files by APC, you need to set apc.rfc1867 to 1 in php.ini, and add a hidden field apc_upload_progress in the form, the value of this field can randomly generate a hash. To be the only one. See the links given above for specific examples.
2. State control and Analysis: PHP APC Source code package comes with a apc.php; you can upload the file to a directory on the Web server and access it in a browser, which shows the current state. We can analyze the current cache status from the table here and make further optimizations. Apc-info-clublocalhost2.png This is the state of a test site. You can analyze it slowly, and this tool will provide a lot of useful tools. For example, you can see which files are often included (accessed), which variables you cache are often read, or are often updated, and so on. Finally, incidentally, there is an independent report that PHP APC's code cache, optimization effect is higher than the Zend Optimizer. Even if it's not true, he's open source and free, it's a pretty good choice.
http://www.bkjia.com/PHPjc/446206.html www.bkjia.com true http://www.bkjia.com/PHPjc/446206.html techarticle because this thing is called optional PHP cache, it is easy to give a kind of can not, not useful illusion. The APC homepage is: HTTP://PECL.PHP.NET/PACKAGE/APC. The current version is 3.0.1 ...