APC Backwards Compatibility (apcu-bc)

APCu was created by removing the opcode caching functionality from the original APC extension. As part of this change, all user cache functions were renamed from apc_* to apcu_* (e.g., apc_store() became apcu_store()).

This renaming poses a challenge for legacy applications that are built to use the original apc_* function names.

The apcu-bc Module

To solve this, a separate backwards compatibility module named apcu-bc is provided.

This module is a thin wrapper that implements the old apc_* function API by simply calling the corresponding apcu_* functions. It serves as a drop-in replacement, allowing legacy code to run on modern PHP versions with APCu without requiring code modifications.

Installation

The apcu-bc module requires that the apcu extension is already installed and enabled.

  1. Install apcu-bc via PECL:

    pecl install apcu_bc
  2. Enable the extension in your php.ini. It must be loaded after apcu.so.

    ; Load apcu first
    extension=apcu.so
    
    ; Then load the compatibility layer
    extension=apcu-bc.so

Source Code

The apcu-bc module is maintained in a separate repository, which is included as a submodule in the main APCu project.