PHP acceleration plug-in ZendOpcache we all know that there are currently three PHP Cache plug-ins: APC, eAccelerator, and XCache, but they may disappear in the future, because PHP 5.5 has already integrated Zend Opcache, features are similar to those of the first three, but there is a little difference. the cache speed is said to be faster than them (note: It is said that I have not tested it ).
The main principles of these PHP plug-ins are the same. they are to buffer the executed PHP data into the memory to avoid repeated compilation processes, you can directly use the compiled code in the buffer zone to increase the speed and reduce the server load. their efficiency is obvious, such as the huge CMS such as drupal, each time you open a page, you need to call dozens of PHP files and execute tens of thousands of lines of code. the efficiency can be imagined. after installing the APC and other accelerators, the page opening speed is significantly faster.
Zend Opcache has been integrated into PHP 5.5. when compiling and installing PHP5.5, add -- enable-opcache. But it also supports earlier versions of PHP 5. 2. *, 5. 3. *, 5. 4. * in the future, the 5.2 support will be canceled. The following is my installation method in PHP 5.4:
Execute the following commands in sequence
wget http://pecl.php.net/get/zendopcache-7.0.2.tgz tar xzf zendopcache-7.0.2.tgz cd zendopcache-7.0.2 phpize
If you cannot find phpize, you can find the PHP path on your own. My php path is/usr/local/php/bin/phpize. in the following line, you need to modify it according to your PHP. ini path.
./configure --with-php-config=/usr/local/php/bin/php-config make make install
If Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-zts-20100525/shows that the installation is complete, modify the php configuration file to make it take effect.
Add the following lines at the end of php. ini:
zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20100525/opcache.so opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1
128 means to allocate MB of memory to it, restart apache, and use phpinfo to check whether it takes effect.
I have read other people's articles, and the performance is 5 ~ 9% improvement.
References:
Http://www.tuicool.com/articles/yY7NRf
Http://www.searchtb.com/2014/02/apc-lock-php-fpm.html
Http://www.bo56.com/php%E7%9A%84-zend-opcache-vs-apc-%E6%80%A7%E8%83%BD%E6%AF%94%E8%BE%83? Spm = 0.0.0.0.NEWthZ