PHP vs. Compilation Cache Question

from my understanding, if you use a PHP caching program such as APC, eAccelerator, etc., then the operation codes will be stored in memory for faster execution on subsequent requests. My question is: why ALWAYS it is better / faster to compile your scripts, assuming you use a compiler like phc or even HPHP (although I know that they have problems with dynamic constructs)? Why store opcodes as they need to be re-read with the Zend Engine, which uses C functions to execute it, when you can just compile and skip this step?

+5
source share
2 answers

You cannot just compile c, and your php script is executed in the same way. HPHP does a real compilation, but does not support the whole set of php functions.

Other compilers actually just inject the php interpreter into the binary, so you still won't compile the code.

PHP is not intended to be compiled. Operation code caching is very fast and good enough for 99% of applications. If you have facebook traffic and have already optimized your back end db, compiling may be the only way to improve performance.

PHP is not a thin layer for the std c library.

+2
source

PHP eval(), , PHP- > () . PHP / " " eval(), . PHP, , . 1 2k script .

+1

All Articles