1.6 KiB
isChild, anchor
isChild | anchor |
---|---|
true | opcode_cache |
Opcode Cache
When a PHP file is executed, it must first be compiled into opcodes (machine language instructions for the CPU). If the source code is unchanged, the opcodes will be the same, so this compilation step becomes a waste of CPU resources.
An opcode cache prevents redundant compilation by storing opcodes in memory and reusing them on successive calls. It will typically check signature or modification time of the file first, in case there have been any changes.
It's likely an opcode cache will make a significant speed improvement to your application. Since PHP 5.5 there is one built in - Zend OPcache. Depending on your PHP package/distribution, it's usually turned on by default - check opcache.enable and the output of phpinfo()
to make sure. For earlier versions there's a PECL extension.
Read more about opcode caches:
- Zend OPcache (bundled with PHP since 5.5)
- Zend OPcache (formerly known as Zend Optimizer+) is now open source
- WinCache (extension for MS Windows Server)
- list of PHP accelerators on Wikipedia
- PHP Preloading - PHP >= 7.4