PHP accelerator

from Wikipedia, the free encyclopedia

PHP accelerators are programs that are supposed to accelerate the execution of PHP scripts. The basis of such accelerators usually forms a bytecode - cache in combination with an optimizer . Starting with version 5.5 PHP uses the Zend Optimizer + as a native accelerator.

functionality

A PHP script is first translated into bytecode before it is executed. It would therefore be necessary to regenerate it every time it is called. By using a bytecode cache, there is no need to constantly generate new ones, as the bytecode is only generated once and then cached. In addition, PHP accelerators can optimize the generated bytecode so that execution is accelerated again.

history

Up to version 5.5 PHP did not have an integrated bytecode cache, so it was necessary to recompile PHP scripts with each call, which led to an additional server load. In order to prevent the constant re-translation, external bytecode caches were developed as extensions, which should upgrade this function. The use of such an extension led to an increase in the execution speed, but brought other problems with it. For example, incorrect caching of the alternative PHP cache in conjunction with PHP 5.4 caused difficulties. When the previously commercial Zend Optimizer + became open source software, it was incorporated into the next PHP version 5.5 as a native accelerator.

Alternative accelerators

In addition to the Zend Optimizer +, there are a few other accelerators for PHP , which are usually also subject to a free license .

eAccelerator

eAccelerator is an open source accelerator and serves both as a bytecode cache and as an optimizer. It saves the bytecode in shared memory and optimizes it during runtime. According to the developers, the server load or execution speed is one to ten times lower or faster than operation without an accelerator.

Alternative PHP cache

The alternative PHP cache ( APC for short ) is also open source, but has the special feature of a user cache. This means that both simple values ​​and complex objects can be cached. This is advantageous, for example, for avoiding repetitive database queries and the associated lower load on the database server . The lifetime of a value is adjustable.

XCache

A relatively new PHP accelerator is XCache , which is developed under an open source license with a focus on security. It saves the generated bytecode in the working memory . In addition, he also has a user cache, however, contrary to APC no objects to cache.

Others

Further accelerators are or were:

  • Turck MMCache - the predecessor of eAccelerator
  • ionCube PHP Accelerator
  • Nusphere PhpExpress
  • Windows Cache Extension for PHP

Alternative compilers

Aside from accelerators, there are also alternative PHP compilers such as PHC , HipHop or Roadsend , which are not an extension , but an independent program, and which first translate the PHP code into C or C ++ source text, from which machine language is then generated. Using it can also reduce server load and memory consumption, usually more than with a bytecode cache.

The disadvantage of alternative PHP compilers, however, is that not the entire range of languages ​​is supported, as this is a separate implementation of the scripting language. On the other hand, other technologies use a machine code compiler from the ground up, such as the Node.js platform, which translates the outgoing JavaScript code into native machine code using the integrated V8 engine in a just-in-time process . Since it is not an independent implementation, the entire language range of JavaScript is also available, although the source code of the actual script language has been compiled into optimized target code.

See also

Individual evidence

  1. Alexander Neumann: PHP 5.5 with bytecode cache Zend Optimizer + released. In: heise Developer. June 21, 2013, accessed May 22, 2016 .
  2. Michael Walter: Full Karacho. PHP accelerators compared. In: Linux magazine. Computec Media GmbH, April 2005, accessed on May 22, 2016 .
  3. Jens Ihlenfeld: PHP: Zend Optimizer + is now open source. In: golem.de. February 13, 2013, accessed May 22, 2016 .
  4. PHP 5.5.0 released. In: php.net. The PHP Group, June 20, 2013, accessed May 22, 2016 .
  5. Jens Ihlenfeld: Opcode cache: Zend Optimizer + is integrated in PHP 5.5. In: golem.de. March 8, 2013, accessed May 22, 2016 .
  6. Alexander Neumann: Zend Optimizer + ends up in PHP 5.5. In: heise Developer. Heise Medien, March 11, 2013, accessed on May 22, 2016 .
  7. Eric Herrmann: Zend Optimizer Plus becomes part of PHP 5.5. In : entwickler.de. Software & Support Media GmbH, March 8, 2013, accessed on May 22, 2016 .
  8. XcacheApi. In: xcache.lighttpd.net. September 3, 2013, accessed on May 22, 2016 .
  9. Jens Ihlenfeld: HipHop - Facebook accelerates PHP. In: golem.de. February 3, 2010, accessed May 22, 2016 .
  10. PHP or Node.js? - Advantages and disadvantages | NodeCode. (No longer available online.) In: NodeCode. May 8, 2014, archived from the original on May 14, 2016 ; accessed on May 22, 2016 . Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / nodecode.de