PHP accelerator

PHP accelerators are programs which are intended to accelerate the execution speed of PHP scripts. This base such an accelerator is usually a bytecode cache in combination with an optimizer. In the current version 5.5, PHP uses the Zend Optimizer as the native promoter.

Operation

A PHP script is first translated into a bytecode before it is executed. Thus, it would be necessary to generate these on every invocation. By use of a byte code cache, the new generation is constantly eliminated as the byte code is generated only once, and then latched. In addition, PHP accelerator optimizations to the generated bytecode can make, so execution is accelerated again.

History

Up to version 5.5 PHP had no built-in bytecode cache, so it was necessary to recompile PHP scripts for each call, which resulted in an additional server load. To prevent the constant re- translating, external bytecode caches were developed as extensions which should retrofit this function. Although the use of such an extension led to an increase in execution speed, but brought other problems. For example, provided a faulty caching of the Alternative PHP Cache in conjunction with PHP 5.4 for trouble. When the pre- commercial Zend Optimizer to open source software, was he came into the next version of PHP 5.5 as a native accelerator.

Alternative accelerator

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

eAccelerator

EAccelerator is an open source accelerator and serves both as a cache or as a byte code optimizer. It stores the bytecode in shared memory and takes optimizations before runtime. The server load and execution speed is up to ten times smaller and faster than the use without an accelerator according to the developers.

Alternative PHP Cache

The Alternative PHP Cache ( APC short ) is also open source, however, has the peculiarity of a user caches. This means that both simple values ​​and complex objects can be cached. This is for example advantageous 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 open-source license with the focus on safety. It stores the generated bytecode in memory. In addition, he also has a user cache, but, in contrast to APC cache any objects.

Other

Further accelerators are or were:

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

Apart from accelerators first PHP code also exist alternative compilers such as PHC, hip-hop or Roadsend which in C or C source code translation, from which machine language is generated. By the use load on the server and the memory consumption can be also reduced.

648511
de