Improve PHP performance with Zend Opcache

Source: Internet
Author: User
Tags apc zend

The predecessor of Zend Opcache was Zend Optimizer + (Zend o+), with PHP5.5 Zend in the release of O+, and renamed: Zend Opcache. However, the default is not enabled, you can enable in the INI file.

According to statistics, Zend Opcache performance is better than APC, can increase by 5%-9%.

Notable is the Zend Opcache support php5.2.0+ version, that is, as long as more than 5.2 of PHP, can be used Zend Opcache, and do not need to upgrade to PHP5.5, so at our current production site can try to use Zend Opcache, such as DRUPAL6, DRUPAL7-based php5.2,php5.3 and other versions.

There is also a discussion on this issue at Drupal University, which links: can Zend Opcache and APC be shared?


Installing Zend Opcache, we recommend the use of a self-sourced or PECL package installation method.

Yum Install Php-pecl-zendopcache.x86_64-y

Enable Zend Opcache, edit/etc/php.d/opcache.ini file

zend_extension=/usr/lib64/php/modules/opcache.so; Determines if Zend Opcache is enabledopcache.enable=1

Restart the Web server and view info to see the Zend Opcache key or use Php-i|grep Opcache.

Related issues,
1. Zend Opcache is to do opcache cache, then APC is also required? Personally, this is not necessary, because the function is repeated, although the two installed at the same time there is no bug, but it is not recommended to use.
The serverfault above also has discussions about the common use of APC and Zend Opcache, and it is recommended not to be used together.
Http://serverfault.com/questions/610524/can-zend-opcode-cache-and-apc-cache-run-together-on-same-server

2. Disable APC-related processing scenarios.
If you do not use the relevant APC functions such as Apc,apc_store, you need to disable. If there are many related APC functions in the system, you can use the APCU module, which only has the user cache function of APC.
and APC upload progress related functions need to be replaced, you can use PHP's own session,session.upload-progress.enabled
Http://php.net/manual/en/session.configuration.php#ini.session.upload-progress.enabled

3. Save_comments Options

Opcache.save_comments=1

If this option is disabled, all comment in PHP will be disabled and performance will improve, but some frameworks may be affected, such as WORDPRESS,DRUPAL8, PHPUnit, etc., and it is recommended not to disable it.

4. Management tools for Zend Opcache
Two more useful opcache management tools, the author tested the first, but looks like a second more powerful, quack ^_^:
Https://github.com/amnuts/opcache-gui
Https://github.com/PeeHaa/OpCacheGUI


Valid links for this article: http://www.drupal001.com/2014/09/zend-opcache-php/

Improve PHP performance with Zend Opcache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.