Reader small image

You're reading from  Mastering PHP 7

Product typeBook
Published inJun 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781785882814
Edition1st Edition
Languages
Right arrow
Author (1)
Branko Ajzele
Branko Ajzele
author image
Branko Ajzele

Branko Ajzele is a respected and highly accomplished software developer, book author, solution specialist, consultant, and team leader. He currently works for Interactive Web Solutions Ltd (iWeb), where he holds the role of senior developer and is the director of iWeb's Croatia office. Branko holds several respected IT certifications, including Zend Certified PHP Engineer, Magento Certified Developer, Magento Certified Developer Plus, Magento Certified Solution Specialist, Magento 2 Certified Solution Specialist, Magento 2 Certified Professional Developer, to mention just a few. He was crowned the e-commerce Developer of the Year by the Digital Entrepreneur Awards in October 2014 for his excellent knowledge and expertise in e-commerce development.
Read more about Branko Ajzele

Right arrow

Zend OPcache


One major downside of PHP is that it loads and parses the PHP script on every request. Written in plain text, the PHP code is first compiled to opcodes, then the opcodes are executed. While this performance impact might not be noticeable with small applications that have one or few scripts in total, it makes a big difference with larger platforms, such as Magento, Drupal, and so on.

Starting from PHP 5.5, there is an out-of-the-box solution to this problem. The Zend OPcache extension addresses the repetitive compilation issue by storing the compiled opcodes in shared memory (RAM). Turning it on or off is simply a matter of changing the configuration directive.

There are quite a few configuration directives, a few of which will get us started:

  • opcache.enable: This defaults to 1 and is changeable via PHP_INI_ALL.
  • opcache.enable_cli: This defaults to 0 and is changeable via PHP_INI_SYSTEM.
  • opcache.memory_consumption: This defaults to 64 and is changeable via PHP_INI_SYSTEM, which defines...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering PHP 7
Published in: Jun 2017Publisher: PacktISBN-13: 9781785882814

Author (1)

author image
Branko Ajzele

Branko Ajzele is a respected and highly accomplished software developer, book author, solution specialist, consultant, and team leader. He currently works for Interactive Web Solutions Ltd (iWeb), where he holds the role of senior developer and is the director of iWeb's Croatia office. Branko holds several respected IT certifications, including Zend Certified PHP Engineer, Magento Certified Developer, Magento Certified Developer Plus, Magento Certified Solution Specialist, Magento 2 Certified Solution Specialist, Magento 2 Certified Professional Developer, to mention just a few. He was crowned the e-commerce Developer of the Year by the Digital Entrepreneur Awards in October 2014 for his excellent knowledge and expertise in e-commerce development.
Read more about Branko Ajzele