How does an Accelerator works?

If you are not familiar about accelerator then read this article on Web Caching first.

Executing a PHP scripts needs few steps:

1. PHP loads the file.
2. It parses the source file, and transforms it into opcode (code that can be executed by the server),
3. It executes the opcode.

The accelerator takes the opcodes from step-2 and caches them in shared memory or on disk. Those cached opcodes are then directly reused the next time the PHP file is demanded, without loading & parsing the file again.

Some accelerator optimizes the code also. It clean empty conditional conditions and loop without any body. But generally it is not of much value. Example accelerators are eAccelerators, APC, Zend platform accelerator and xCache.

How it is different from data or content caching?

When you cache your data then it is the final HTML data, which need to be sending for a page request. Here you will check that HTML data is ready or not? If ready then that data will be send to PHP parser. This way you saved database overhead and other processing by PHP parser. But this time PHP needs to contact the requested page and your requested page is checking for HTML output. In case of opcode, PHP will not come to your page script. They will directly serve user’s request. (I think I am right!)