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.

Reduced compilation workPreviously compiled PHP bytecode can be reused for later requests.
Lower CPU usageLess repeated compilation reduces processor overhead.
Additional memory useCached bytecode is stored in memory, so acceleration trades some RAM for faster execution.
Faster PHP executionThe source documentation describes execution time as potentially reduced to roughly half, though actual results depend on the application and server workload.

Available Accelerators

  • APC
  • XCache
  • eAccelerator — documented for PHP 5.3 and PHP 5.4 only
  • ZendGuardLoader — documented for PHP 5.3 only
i

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

1

Open server configuration

Locate the PHP application server in the environment and click Config.

2

Open php.ini

In the etc folder, open the php.ini configuration file.

3

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.

4

Configure accelerator settings

Adjust the module-specific parameters in php.ini when required by the selected accelerator.

5

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.ini before 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.

Common Issues and Solutions

Extension cannot be loadedConfirm that the module file exists and supports the selected PHP version.
PHP server fails to restartComment the extension directive again and review PHP startup logs for compatibility or syntax errors.
No performance improvementConfirm that the accelerator is active and review its cache size, memory limits, and application workload.
Memory usage increasesReduce the accelerator cache allocation or review whether acceleration is appropriate for the workload.
Multiple accelerator conflictsEnable only one supported bytecode accelerator unless the extension documentation explicitly allows another configuration.