Alternative PHP Cache (APC) – Overview and Modern Alternatives
Alternative PHP Cache (APC) was an open-source PHP accelerator used to improve the performance of PHP applications. It worked by caching the compiled PHP bytecode in shared memory, which reduced the need to compile PHP scripts on every request. This helped applications run faster and reduced server load.
During PHP execution, scripts are first compiled into intermediate code, also known as opcodes. APC stored these opcodes in memory and reused them for future requests, almost eliminating compilation overhead.
Important Note: APC is now deprecated and is no longer maintained. It does not support modern PHP versions and should not be used on current production servers.
Why APC Is No Longer Recommended ?
-
APC is incompatible with modern PHP versions
-
The project is no longer maintained
-
PHP introduced better and safer alternatives
-
Modern Linux distributions no longer support APC packages
APC was split into two separate solutions:
-
OPcache – for opcode (bytecode) caching
-
APCu – for user data caching
These are now the recommended replacements for APC.
Recommended Modern PHP Caching Solutions
1. OPcache (Opcode Cache)
OPcache is built into PHP and is enabled by default on most systems. It stores precompiled script bytecode in shared memory and significantly improves performance.
Enable OPcache
Edit your php.ini file:
Restart your web server and verify using:
or check the OPcache section in phpinfo().
2. APCu (User Cache)
APCu provides in-memory caching for application data such as variables, objects, and results.
Install APCu using PECL
Add the following line to php.ini :
extension=apcu.so
Restart the web server to apply changes.
Legacy Information: Installing APC (For Old PHP Versions Only)
Use this section only for documentation or very old systems running unsupported PHP versions.
Basic Legacy Steps (Not Recommended Today)
-
Download APC from PECL
-
Extract the source archive
-
Run phpize
-
Configure, compile, and install
-
Add extension=apc.so to php.ini
-
Restart the web server
These steps are obsolete and should not be used on modern systems.
How to Verify PHP Caching
After enabling OPcache or APCu :
phpinfo()
Look for:
-
Zend OPcache section
-
APCu section (if installed)
Conclusion
APC played an important role in improving PHP performance in the past, but it is now outdated and unsupported. Modern PHP environments should always use OPcache for opcode caching and APCu for user data caching to achieve better performance, stability, and security.
If you require help, contact SupportPRO Server Admin
