When a
PHP script is called by a users browser the process is as folllows:
- User requests page
- Web server compiles the PHP script (interprets)
- Executes the compiled version of the page
- Outputs the data
When we think of normal applications such as programs on your desktop, the compiling step is not one we normally consider. Usually the applications we use are already
compiled. However, scripting languages such as
PHP, Perl, Ruby, etc., are compiled on demand or interpreted. There are subtle differences between compiling and interpreting but that is for another day.
As you can imagine, converting source code to machine code (opcode) can be resource intensive. Opcode caches will store the opcode in a cache and execute it instead of constantly recompiling the source code. This basically eliminates step 2 in the above list and seriously speeds up your site.
There are many opcode caches out there such as
Xcache, APC, etc.. No large site should be without one!