PHP acceleration plug-in after 5.5: ZEND OPCACHE_PHP tutorial

WBOY
Release: 2016-07-13 10:04:40
Original
918 people have browsed it

Acceleration plug-in for PHP 5.5 and later: ZEND OPCACHE

As we all know, there are generally three PHP caching plug-ins: APC, eAccelerator, and XCache, but they may all disappear in the future, because PHP 5.5 has integrated Zend Opcache, and its functions are similar to the first three but slightly different. The caching speed is said to be faster than them (note: it is just said, I have not tested it).

PHP 5.5以后加速插件:ZEND OPCACHE

The error when compiling eAccelerator with php5.5 or later versions is as follows:

<ol class="dp-j"><li class="alt"><span><span>cd /usr/local/src/php-</span><span class="number">5.6</span><span>.</span><span class="number">0</span><span>/ext/opcache </span></span></li><li><span> </span></li><li class="alt"><span>/usr/local/webserver/php/bin/phpize </span></li><li><span> </span></li><li class="alt"><span>./configure --with-php-config=/usr/local/webserver/php/bin/php-config </span></li><li><span> </span></li><li class="alt"><span>make && make install </span></li></ol>
Copy after login

It is best to modify /etc/php.ini and add at the end:

<ol class="dp-j"><li class="alt"><span><span>opcache] </span></span></li><li><span> </span></li><li class="alt"><span>zend_extension=/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-<span class="number">20131226</span><span>/opcache.so </span></span></li><li><span> </span></li><li class="alt"><span>opcache.memory_consumption=<span class="number">128</span><span> </span></span></li><li><span> </span></li><li class="alt"><span>opcache.interned_strings_buffer=<span class="number">8</span><span> </span></span></li><li><span> </span></li><li class="alt"><span>opcache.max_accelerated_files=<span class="number">4000</span><span> </span></span></li><li><span> </span></li><li class="alt"><span>opcache.revalidate_freq=<span class="number">60</span><span> </span></span></li><li><span> </span></li><li class="alt"><span>opcache.fast_shutdown=<span class="number">1</span><span> </span></span></li><li><span> </span></li><li class="alt"><span>opcache.enable_cli=<span class="number">1</span><span> </span></span></li></ol>重启php-fpm:<br />究其原因是PHP5.5以下版本有php_logos.c,php_logos.h等文件。
Copy after login

If you want to continue using acceleration in the new version, we currently know that PHP comes with the extension opcache.

<ol class="dp-j"><li class="alt"><span><span>1kill -USR2 `cat /usr/local/webserver/php/var/run/php-fpm.pid` </span></span></li></ol>
Copy after login

The test address is https://gist.github.com/ck-on/4959032. Save the above code as a php file and open it in your website directory to see it.



www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/964930.htmlTechArticleAcceleration plug-in for PHP 5.5 and later: ZEND OPCACHE We all know that there are currently three cache plug-ins for PHP: APC, eAccelerator, and XCache , but they may all disappear in the future, because PHP 5.5 has been integrated...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!