PHP Accelerators
PHP Accelerators
A PHP accelerator is an extension that improves PHP application performance by caching compiled bytecode. This reduces repeated script compilation, saves CPU time, and can improve application response speed at the cost of additional memory usage.
How PHP Accelerators Work
PHP source code is normally compiled and then executed at runtime. A PHP accelerator stores the compiled bytecode in memory so that future requests can reuse it instead of compiling the same scripts again.
Available Accelerators
- APC
- XCache
- eAccelerator — documented for PHP 5.3 and PHP 5.4 only
- ZendGuardLoader — documented for PHP 5.3 only
Legacy compatibility
The accelerator names and PHP-version limits above come from the source documentation and reflect older PHP stacks. Check the extensions available in the PHP version currently running in your environment before enabling one.
Activate a PHP Accelerator
Open server configuration
Locate the PHP application server in the environment and click Config.
Open php.ini
In the etc folder, open the php.ini configuration file.
Enable one accelerator
Find the accelerator section and uncomment the required extension directive:
extension=apc.so extension=eaccelerator.so extension=xcache.so extension=ZendGuardLoader.so
Enable only a compatible extension
Do not enable every listed directive. Uncomment only the accelerator supported by the selected PHP version and application-server stack.
Configure accelerator settings
Adjust the module-specific parameters in php.ini when required by the selected accelerator.
Save and restart the node
Save the configuration and restart the PHP application-server node.
Expected Result
The selected compatible PHP accelerator is loaded after the node restart and begins caching compiled PHP bytecode according to its configuration.
Important Notes
- Back up
php.inibefore changing extension settings. - Enable only accelerators available for the current PHP version.
- Restart the node after changing the accelerator configuration.
- Monitor memory usage because bytecode caching consumes additional RAM.
- Review PHP startup logs if the node does not start after enabling an extension.
- Modern PHP stacks commonly use OPcache; the source page itself documents older accelerators and compatibility limits.
