cache| site Commercial application of the site, its transmission efficiency is very important, usually in some e-commerce sites, the server's response speed determines its quality of service, the server's load determines its maximum available customer access capacity. Technicians are always trying to improve the responsiveness of the server as much as possible. And Zendcache is also to improve the response speed of the server to develop an excellent product. There is data to prove that using Zendcache can increase the response speed of the server to the original 300% or more.
first, what is Zendcache?
First look at how PHP is running, a request for PHP script sent to the server, the server from the disk to find the appropriate files, first compile the script, and then execute it, and finally send the results. The time spent is made up of finding files + opening files + reading files + compiling files. Zendcache is a PHP script cache that can store the compiled results of just the PHP script file in the Web server's memory, and it can be sent out soon if the next time someone requests it. Eliminates the time it takes for a server to compile a script every time a user requests a PHP file. Also, avoid the time it takes to find and read PHP files from disk. So you can greatly improve the server's corresponding speed.
Currently Zendcache can only run on Linux (glibc 2.1), Solaris 2.6, FreeBSD 3.4, and 4.0. Unfortunately, currently it is not supported on Windows systems.
second, installation and use of Zendcache
Register a user on the zend.com, log on to the zend.com, and then download http://www.zend.com/store/products/zend-cache.php at the following address. Since Zendcache is a subscription software, we can only download a trial version of a limited date that can be used for 30 days, but it is a fully functional package. Try it, you can experience its powerful function. To download its trial version, select the "Test drive available" download directly.
The entire download should be divided into three steps, the first step, download Zendcache software package, directly from the "Supported platforms" select the appropriate platform package. Note the application of the software platform and the corresponding version of PHP, class library type.
The second step is "request Product License", that is, to obtain authorization from the zend.com, require the user to provide their own machine host ID, also is the computer network card MAC address, Zend.com provides a tool to read the host network card address, the user can download a small program called Lmutil.z from Zend.com, after decompression, execute it, you can get the computer's network card address. How to execute:
#./lmutil Lmhostid
The host ID can be obtained. In addition, the user can also find the MAC address of the NIC from the/var/log/messages.
This ID number is filled in the form of the application license, select "Request", and then wait patiently, zend.com will send you an email within 48 hours, notify you to download your own license. After receiving the message, go directly to http://www.zend.com/store/pickup.php to download it. License is a file called Zend_cache.dat.
Installation (for example, install in Linux environment)
Extract zendcache-1[1].0.0-php_4.0.4-linux_glibc2.1-i386.tar.gz Files
# TAR–ZXVF Zendcache-1[1].0.0-php_4.0.4-linux_glibc2.1-i386.tar.gz
# CD Zendcache-1[1].0.0-php_4.0.4-linux_glibc2.1-i386
# CP *.so/usr/local/zend/lib
Then, copy the Zend_cache.dat to the/usr/local/zend directory.
Then edit the php.ini file and add the following lines:
; Start of sample Zend Cache configuration section
Zend_cache.use_cwd=1
zend_cache.memory_consumption=64; 64MB
Zend_cache.validate_timestamps=1
Zend_extension=/usr/local/lib/zendcache.so
; End of sample Zend Cache configuration section
Restart the Apache server. To bring the changes into effect.
Edit a simple php file test.php in the Htdocs directory of the Web server, as follows:
?
Phpinfo ();
? >
Then, type http://localhost/test.php on the browser
If the second part of the screen appears
This program makes the Zend scripting language engine:
Zend Engine v1.x.x, Copyright (c) 1998-2000 Zend Technologies
With Zend Cache v1.x.x, the Copyright (c) 1999-2000, by Zend Technologies
The word "Zendcache" indicates that it is working properly. The rest is to look at its cache hit effect.
third, the test Zendcache hit rate
Along with the Zendcache package, there is also a portion of the PHP code that can visually display the Zendcache hit effect. Simply copy the Cache_gui subdirectory to the Htdocs directory of the Web server. You can see the cache hit effect by typing http://localhost/cach_gui/index.html in the browser URL bar. As shown in the following figure, the Zendcache after the author installs the hit Effect chart:
If the graphics in your browser are not displayed and you are prompted to compile the GD module in PHP that does not support PNG graphics, you will have to compile PHP again to enable the GD module to support the PNG graphics display. Articles on how to compile PHP so that it supports PNG can be found on the web, and this article is not documented. If you don't know if PHP supports PNG, you can use the Phpinfo () function to view it. In general, if you do not specifically indicate that PNG is supported at compile time, GD will not support PNG by default at compile time.
Note: If you use Zendoptimizer at the same time, you should put the above lines behind Zendoptimizer, or your Apache server will not get up.