Cache the bytecode


Bytecode (called opcode for PHP) is the binary code generated from the source code. Some accelerators are able to cache bytecode, which avoids needing to recompile it from the source code every time. Less time spent compiling equals less CPU and RAM used.

A standard PHP script can serve: - 298 requests per minute (without an accelerator) - 914 requests per minute (with the APC accelerator) That is 3 times more requests for the same machine.

To view the list of PHP accelerators:

You can also use the HipHop for PHP compiler which translates PHP source code into C++, which is then compiled into a native binary using g++.

This best practice should only be applied if it is coherent with your project's specifications.
Under CC-By-NX-SA license